File: run-test

package info (click to toggle)
patchutils 0.4.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,976 kB
  • sloc: ansic: 20,804; sh: 11,956; xml: 2,831; perl: 419; makefile: 300; python: 23
file content (53 lines) | stat: -rwxr-xr-x 1,289 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

# This is an interdiff(1) testcase.
# Test: Regression test to ensure existing behavior without -w is preserved

. ${top_srcdir-.}/tests/common.sh

# Create a simple scenario that should work the same way as before
cat << EOF > file1.txt
line1
line2
line3
EOF

cat << EOF > file2.txt
line1
line2 changed
line3
EOF

cat << EOF > file3.txt
line1
line2 changed again
line3
EOF

# Create patches
${DIFF} -u file1.txt file2.txt > patch1 || true
${DIFF} -u file2.txt file3.txt > patch2 || true

# Test without any whitespace options - should work as before
${INTERDIFF} patch1 patch2 > result-baseline 2>errors-baseline || exit 1

# Verify the result contains expected changes
grep "line2 changed again" result-baseline > /dev/null || exit 1

# Test with -b option (should still work)
${INTERDIFF} -b patch1 patch2 > result-b 2>errors-b || exit 1

# Test with -B option (should still work)
${INTERDIFF} -B patch1 patch2 > result-B 2>errors-B || exit 1

# Test with -i option (should still work)
${INTERDIFF} -i patch1 patch2 > result-i 2>errors-i || exit 1

# All tests should produce similar results for this simple case
[ -s result-baseline ] || exit 1
[ -s result-b ] || exit 1
[ -s result-B ] || exit 1
[ -s result-i ] || exit 1

# Success - existing behavior is preserved
exit 0