Debian Codegraph @

tests/grepdiff8/run-test

raw
1 #!/bin/sh
2
3 # This is a grepdiff(1) testcase.
4
5
6 . ${top_srcdir-.}/tests/common.sh
7
8 cat << EOF > diff
9 --- file1
10 +++ file1
11 @@ -1,2 +1,2 @@
12 context
13 -a
14 +b
15 --- file2
16 +++ file2
17 @@ -1 +1 @@
18 -bx
19 +a
20 EOF
21
22 ${GREPDIFF} --only-match=rem 'a' diff 2>errors >rem || exit 1
23 ${GREPDIFF} --only-match=add 'a' diff 2>>errors >add || exit 1
24 ${GREPDIFF} --only-match=mod 'x' diff 2>>errors >mod || exit 1
25 ${GREPDIFF} --only-match=all 'x' diff 2>>errors >all || exit 1
26
27 [ -s errors ] && exit 1
28
29 cat << EOF | cmp - rem || exit 1
30 file1
31 EOF
32
33 cat << EOF | cmp - add || exit 1
34 file2
35 EOF
36
37 cat << EOF | cmp - mod || exit 1
38 file2
39 EOF
40
41 cat << EOF | cmp - all || exit 1
42 file1
43 file2
44 EOF