Debian Codegraph @

tests/interdiff-devnull/run-test

raw
1 #!/bin/sh
2
3 # Test interdiff with /dev/null automatic -p detection
4 # This tests that interdiff can auto-detect -p values when dealing with /dev/null
5
6 . ${top_srcdir-.}/tests/common.sh
7
8 # Create first patch (creates a file with initial content)
9 cat << EOF > patch1
10 --- /dev/null
11 +++ b/newfile.txt
12 @@ -0,0 +1,3 @@
13 +line one
14 +line two
15 +line three
16 EOF
17
18 # Create second patch (creates the same file with different content)
19 cat << EOF > patch2
20 --- /dev/null
21 +++ a/newfile.txt
22 @@ -0,0 +1,4 @@
23 +line one
24 +inserted line
25 +line two
26 +line three
27 EOF
28
29 # Expected interdiff output (should auto-detect -p1)
30 # This shows what needs to change to go from patch1's result to patch2's result
31 cat << EOF > expected
32 diff -u b/newfile.txt a/newfile.txt
33 --- b/newfile.txt
34 +++ a/newfile.txt
35 @@ -1,3 +1,4 @@
36 line one
37 +inserted line
38 line two
39 line three
40 EOF
41
42 # Run interdiff
43 ${INTERDIFF} patch1 patch2 2>errors >actual || exit 1
44 [ -s errors ] && exit 1
45
46 # Compare the actual output with expected
47 diff -u expected actual || exit 1
48
49 exit 0