| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is an interdiff(1) testcase. |
| 4 |
# Test: Verify that -w option makes patch application ignore whitespace |
| 5 |
|
| 6 |
. ${top_srcdir-.}/tests/common.sh |
| 7 |
|
| 8 |
# Simple test to verify -w functionality works |
| 9 |
cat << EOF > file1 |
| 10 |
line1 |
| 11 |
line2 |
| 12 |
line3 |
| 13 |
EOF |
| 14 |
|
| 15 |
cat << EOF > file2 |
| 16 |
line1 |
| 17 |
line2 changed |
| 18 |
line3 |
| 19 |
EOF |
| 20 |
|
| 21 |
cat << EOF > file3 |
| 22 |
line1 |
| 23 |
line2 changed |
| 24 |
line3 |
| 25 |
line4 |
| 26 |
EOF |
| 27 |
|
| 28 |
# Create patches |
| 29 |
${DIFF} -u file1 file2 > patch1 || true |
| 30 |
${DIFF} -u file2 file3 > patch2 || true |
| 31 |
|
| 32 |
# Test basic functionality - both should work |
| 33 |
${INTERDIFF} patch1 patch2 > result-no-w 2>errors-no-w || exit 1 |
| 34 |
${INTERDIFF} -w patch1 patch2 > result-with-w 2>errors-with-w || exit 1 |
| 35 |
|
| 36 |
# Both should produce output |
| 37 |
[ -s result-no-w ] || exit 1 |
| 38 |
[ -s result-with-w ] || exit 1 |
| 39 |
|
| 40 |
# Should show addition of line4 |
| 41 |
grep "line4" result-with-w > /dev/null || exit 1 |
| 42 |
|
| 43 |
exit 0 |