| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is a lsdiff(1) testcase. |
| 4 |
# Test: lsdiff -H behaviour |
| 5 |
|
| 6 |
|
| 7 |
. ${top_srcdir-.}/tests/common.sh |
| 8 |
|
| 9 |
mkdir dir dir.orig |
| 10 |
echo a > file1.orig |
| 11 |
echo A > file1 |
| 12 |
${DIFF} -u file1.orig file1 > diff1 |
| 13 |
echo a > file2.orig |
| 14 |
echo A > file2 |
| 15 |
${DIFF} -u file2.orig file2 > diff2 |
| 16 |
${LSDIFF} -H diff1 diff2 2>errors >index || exit 1 |
| 17 |
[ -s errors ] && exit 1 |
| 18 |
|
| 19 |
cat << EOF | cmp - index || exit 1 |
| 20 |
diff1:file1 |
| 21 |
diff2:file2 |
| 22 |
EOF |
| 23 |
|
| 24 |
${LSDIFF} diff1 diff2 2>errors >index || exit 1 |
| 25 |
[ -s errors ] && exit 1 |
| 26 |
|
| 27 |
cat <<EOF | cmp - index || exit 1 |
| 28 |
diff1:file1 |
| 29 |
diff2:file2 |
| 30 |
EOF |
| 31 |
|
| 32 |
cat diff1 | ${LSDIFF} -H 2>errors >index || exit 1 |
| 33 |
[ -s errors ] && exit 1 |
| 34 |
|
| 35 |
cat << EOF | cmp - index || exit 1 |
| 36 |
(standard input):file1 |
| 37 |
EOF |
| 38 |
|
| 39 |
cat diff1 | ${LSDIFF} 2>errors >index || exit 1 |
| 40 |
[ -s errors ] && exit 1 |
| 41 |
cat << EOF | cmp - index || exit 1 |
| 42 |
file1 |
| 43 |
EOF |
| 44 |
|
| 45 |
${LSDIFF} -Hnv diff1 diff2 2>errors >index || exit 1 |
| 46 |
[ -s errors ] && exit 1 |
| 47 |
|
| 48 |
cat << EOF | cmp - index || exit 1 |
| 49 |
diff1:1 file1 |
| 50 |
diff1- 3 Hunk #1 |
| 51 |
diff2:5 file2 |
| 52 |
diff2- 7 Hunk #1 |
| 53 |
EOF |
| 54 |
|
| 55 |
${LSDIFF} -nv diff1 diff2 2>errors >index || exit 1 |
| 56 |
[ -s errors ] && exit 1 |
| 57 |
cat << EOF | cmp - index || exit 1 |
| 58 |
diff1:1 file1 |
| 59 |
diff1- 3 Hunk #1 |
| 60 |
diff2:5 file2 |
| 61 |
diff2- 7 Hunk #1 |
| 62 |
EOF |