Debian Codegraph @

tests/flip15/run-test

raw
1 #!/bin/sh
2
3 # This is a flipdiff(1) testcase.
4
5
6 . ${top_srcdir-.}/tests/common.sh
7
8 # When a line is touched by both patches, the first patch after flipping
9 # should get the change. Rationale: the patches ought to be largely
10 # independent, and this is the best way of preserving the intent.
11
12 cat << EOF > file.orig
13 int a;
14 EOF
15
16 cat << EOF > file
17 int a, b;
18 EOF
19
20 ${DIFF} -u file.orig file > patch1
21
22 mv -f file file.orig
23 cat << EOF > file
24 ssize_t a, b;
25 EOF
26
27 ${DIFF} -u file.orig file > patch2
28
29 ${FLIPDIFF} patch1 patch2 > patch-flipped || exit 1
30 sed -e "s/$(printf '\t').*$//" patch-flipped > patch-cmp
31 cmp - patch-cmp << EOF || exit 1
32 --- file.orig
33 +++ file
34 @@ -1 +1 @@
35 -int a;
36 +ssize_t a, b;
37
38 === 8< === cut here === 8< ===
39
40 EOF