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 (43 lines) | stat: -rwxr-xr-x 811 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
#!/bin/sh

# This is an interdiff(1) testcase.
# Test: Verify that -w option makes patch application ignore whitespace

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

# Simple test to verify -w functionality works
cat << EOF > file1
line1
line2
line3
EOF

cat << EOF > file2
line1
line2 changed
line3
EOF

cat << EOF > file3
line1
line2 changed
line3
line4
EOF

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

# Test basic functionality - both should work
${INTERDIFF} patch1 patch2 > result-no-w 2>errors-no-w || exit 1
${INTERDIFF} -w patch1 patch2 > result-with-w 2>errors-with-w || exit 1

# Both should produce output
[ -s result-no-w ] || exit 1
[ -s result-with-w ] || exit 1

# Should show addition of line4
grep "line4" result-with-w > /dev/null || exit 1

exit 0