| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# This is an interdiff(1) test case. |
| 4 |
# Test: -U3 works correctly. |
| 5 |
|
| 6 |
|
| 7 |
. ${top_srcdir-.}/tests/common.sh |
| 8 |
|
| 9 |
cat << EOF > file.orig |
| 10 |
one |
| 11 |
two |
| 12 |
three |
| 13 |
EOF |
| 14 |
cat << EOF > file |
| 15 |
one |
| 16 |
two |
| 17 |
three |
| 18 |
add some stuff |
| 19 |
to the file |
| 20 |
which had 3 lines |
| 21 |
EOF |
| 22 |
${DIFF} -U0 file.orig file > patch |
| 23 |
${INTERDIFF} -U3 /dev/null patch 2>errors > interdiffed || exit 1 |
| 24 |
[ -s errors ] && exit 1 |
| 25 |
# Should be four lines beginning '+' (one in the header) |
| 26 |
count=$(grep '^+' interdiffed | wc -l) |
| 27 |
[ "$count" -eq 4 ] || exit 1 |
| 28 |
grep -q '^ ' interdiffed && exit 1 |
| 29 |
exit 0 |