| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is an interdiff(1) testcase. |
| 4 |
# Test: Regression test to ensure existing behavior without -w is preserved |
| 5 |
|
| 6 |
. ${top_srcdir-.}/tests/common.sh |
| 7 |
|
| 8 |
# Create a simple scenario that should work the same way as before |
| 9 |
cat << EOF > file1.txt |
| 10 |
line1 |
| 11 |
line2 |
| 12 |
line3 |
| 13 |
EOF |
| 14 |
|
| 15 |
cat << EOF > file2.txt |
| 16 |
line1 |
| 17 |
line2 changed |
| 18 |
line3 |
| 19 |
EOF |
| 20 |
|
| 21 |
cat << EOF > file3.txt |
| 22 |
line1 |
| 23 |
line2 changed again |
| 24 |
line3 |
| 25 |
EOF |
| 26 |
|
| 27 |
# Create patches |
| 28 |
${DIFF} -u file1.txt file2.txt > patch1 || true |
| 29 |
${DIFF} -u file2.txt file3.txt > patch2 || true |
| 30 |
|
| 31 |
# Test without any whitespace options - should work as before |
| 32 |
${INTERDIFF} patch1 patch2 > result-baseline 2>errors-baseline || exit 1 |
| 33 |
|
| 34 |
# Verify the result contains expected changes |
| 35 |
grep "line2 changed again" result-baseline > /dev/null || exit 1 |
| 36 |
|
| 37 |
# Test with -b option (should still work) |
| 38 |
${INTERDIFF} -b patch1 patch2 > result-b 2>errors-b || exit 1 |
| 39 |
|
| 40 |
# Test with -B option (should still work) |
| 41 |
${INTERDIFF} -B patch1 patch2 > result-B 2>errors-B || exit 1 |
| 42 |
|
| 43 |
# Test with -i option (should still work) |
| 44 |
${INTERDIFF} -i patch1 patch2 > result-i 2>errors-i || exit 1 |
| 45 |
|
| 46 |
# All tests should produce similar results for this simple case |
| 47 |
[ -s result-baseline ] || exit 1 |
| 48 |
[ -s result-b ] || exit 1 |
| 49 |
[ -s result-B ] || exit 1 |
| 50 |
[ -s result-i ] || exit 1 |
| 51 |
|
| 52 |
# Success - existing behavior is preserved |
| 53 |
exit 0 |