diffutils/tests/label-vs-func
Jim Meyering 55cf264a2b tests: use path_prepend_ consistently; remove unnecessary VERBOSE check
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/label-vs-func: Likewise.
* tests/stdin: Likewise.
2010-04-07 11:01:31 +02:00

33 lines
467 B
Bash
Executable File

#!/bin/sh
# Show how diff's -p option can mistakenly match a label: in column 1.
: ${srcdir=.}
. "$srcdir/init.sh"; path_prepend_ ../src
fail=0
cat <<EOF > exp || fail=1
@@ -4 +4 @@ label:
-1;
+2;
EOF
cat <<EOF > a || fail=1
func ()
{
label:
1;
}
EOF
sed s/1/2/ a > b || fail=1
diff -p -u0 a b > out 2> err; test $? = 1 || fail=1
tail -3 out > k && mv k out || fail=1
compare out exp || fail=1
# expect empty stderr
compare err /dev/null || fail=1
Exit $fail