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 (49 lines) | stat: -rwxr-xr-x 1,011 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
#!/bin/sh

# Test interdiff with /dev/null automatic -p detection
# This tests that interdiff can auto-detect -p values when dealing with /dev/null

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

# Create first patch (creates a file with initial content)
cat << EOF > patch1
--- /dev/null
+++ b/newfile.txt
@@ -0,0 +1,3 @@
+line one
+line two
+line three
EOF

# Create second patch (creates the same file with different content)
cat << EOF > patch2
--- /dev/null
+++ a/newfile.txt
@@ -0,0 +1,4 @@
+line one
+inserted line
+line two
+line three
EOF

# Expected interdiff output (should auto-detect -p1)
# This shows what needs to change to go from patch1's result to patch2's result
cat << EOF > expected
diff -u b/newfile.txt a/newfile.txt
--- b/newfile.txt
+++ a/newfile.txt
@@ -1,3 +1,4 @@
 line one
+inserted line
 line two
 line three
EOF

# Run interdiff
${INTERDIFF} patch1 patch2 2>errors >actual || exit 1
[ -s errors ] && exit 1

# Compare the actual output with expected
diff -u expected actual || exit 1

exit 0