Debian Codegraph @

tests/flip6/run-test

raw
1 #!/bin/sh
2
3 # This is a flipdiff(1) testcase.
4
5
6 . ${top_srcdir-.}/tests/common.sh
7
8 cat << EOF > file.orig
9 a
10 b
11 c
12 d
13 e
14 f
15 g
16 h
17 i
18 j
19 k
20 l
21 EOF
22
23 cat << EOF > file
24 a
25 b
26 apple
27 banana
28 cat
29 dog
30 d
31 e
32 f
33 g
34 h
35 i
36 j
37 k
38 l
39 EOF
40
41 ${DIFF} -u file.orig file > patch1
42
43 mv -f file file.orig
44 cat << EOF > file
45 a
46 b
47 apple
48 banana
49 cat
50 dog
51 elephant
52 d
53 e
54 f
55 g
56 h
57 i
58 j
59 k
60 l
61 EOF
62
63 ${DIFF} -u file.orig file > patch2
64
65 ${FLIPDIFF} patch1 patch2 > patch-flipped || exit 1
66 sed -e "s/$(printf '\t').*$//" patch-flipped > patch-cmp
67 cmp - patch-cmp << EOF || exit 1
68 --- file.orig
69 +++ file
70 @@ -1,6 +1,7 @@
71 a
72 b
73 c
74 +elephant
75 d
76 e
77 f
78
79 === 8< === cut here === 8< ===
80
81 --- file.orig
82 +++ file
83 @@ -1,6 +1,9 @@
84 a
85 b
86 -c
87 +apple
88 +banana
89 +cat
90 +dog
91 elephant
92 d
93 e
94 EOF