Debian Codegraph @

tests/flip5/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 cat
27 dog
28 d
29 e
30 f
31 g
32 h
33 i
34 j
35 k
36 l
37 EOF
38
39 ${DIFF} -u file.orig file > patch1
40
41 mv -f file file.orig
42 cat << EOF > file
43 a
44 b
45 cat
46 dog
47 elephant
48 d
49 e
50 f
51 g
52 h
53 i
54 j
55 k
56 l
57 EOF
58
59 ${DIFF} -u file.orig file > patch2
60
61 ${FLIPDIFF} patch1 patch2 > patch-flipped || exit 1
62 sed -e "s/$(printf '\t').*$//" patch-flipped > patch-cmp
63 cmp - patch-cmp << EOF || exit 1
64 --- file.orig
65 +++ file
66 @@ -1,6 +1,7 @@
67 a
68 b
69 c
70 +elephant
71 d
72 e
73 f
74
75 === 8< === cut here === 8< ===
76
77 --- file.orig
78 +++ file
79 @@ -1,6 +1,7 @@
80 a
81 b
82 -c
83 +cat
84 +dog
85 elephant
86 d
87 e
88 EOF