-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathrun-test
More file actions
executable file
·54 lines (45 loc) · 1.13 KB
/
run-test
File metadata and controls
executable file
·54 lines (45 loc) · 1.13 KB
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
54
#!/bin/sh
# Test interdiff with patch2 having headers between +++ and @@
# This tests that interdiff can handle extra headers (like "index") between
# the +++ line and @@ line in patch2, without incorrectly reporting it as empty
. ${top_srcdir-.}/tests/common.sh
# Create first patch (simple unified diff)
cat << EOF > patch1
--- a/file.txt
+++ b/file.txt
@@ -1,3 +1,3 @@
line one
-line two
+line TWO
line three
EOF
# Create second patch (git-style with index line between +++ and @@)
cat << EOF > patch2
--- a/file.txt
+++ b/file.txt
index abc123..def456 100644
@@ -1,3 +1,3 @@
line one
-line two
+line 2
line three
EOF
# Expected interdiff output
# This shows the difference between changing "two" to "TWO" vs "2"
cat << EOF > expected
diff -u b/file.txt b/file.txt
--- b/file.txt
+++ b/file.txt
@@ -1,3 +1,3 @@
line one
-line TWO
+line 2
line three
EOF
# Run interdiff - should succeed without errors
${INTERDIFF} patch1 patch2 2>errors >actual || exit 1
# Should not have any errors (especially not "patch2 is empty" or similar)
[ -s errors ] && exit 1
# Compare the actual output with expected
diff -u expected actual || exit 1
exit 0