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

# Test combinediff with multiple path levels requiring -p2
# This tests the automatic detection of deeper path stripping

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

# Create first patch with deeply nested path
cat << EOF > patch1
--- /dev/null
+++ b/src/deep/nested/file.c
@@ -0,0 +1,2 @@
+#include <stdio.h>
+int main() { return 0; }
EOF

# Create second patch modifying the same file with different path prefix
cat << EOF > patch2
--- a/src/deep/nested/file.c
+++ b/src/deep/nested/file.c
@@ -1,2 +1,3 @@
 #include <stdio.h>
+#include <stdlib.h>
 int main() { return 0; }
EOF

# Expected combined output (should auto-detect -p1)
cat << EOF > expected
diff -u /dev/null b/src/deep/nested/file.c
--- /dev/null
+++ b/src/deep/nested/file.c
@@ -0,0 +1,3 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main() { return 0; }
EOF

# Run combinediff
${COMBINEDIFF} 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