Debian Codegraph @

tests/grepdiff9/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 ***************
12 *** 1,2 ****
13 context
14 - a
15 --- 1,2 ----
16 context
17 + b
18 *** file2
19 --- file2
20 ***************
21 *** 1 ****
22 - bx
23 --- 1 ----
24 + a
25 EOF
26
27 ${GREPDIFF} --only-match=rem 'a' diff 2>errors >rem || exit 1
28 ${GREPDIFF} --only-match=add 'a' diff 2>>errors >add || exit 1
29 ${GREPDIFF} --only-match=mod 'x' diff 2>>errors >mod || exit 1
30 ${GREPDIFF} --only-match=all 'x' diff 2>>errors >all || exit 1
31
32 [ -s errors ] && exit 1
33
34 cat << EOF | cmp - rem || exit 1
35 file1
36 EOF
37
38 cat << EOF | cmp - add || exit 1
39 file2
40 EOF
41
42 cat << EOF | cmp - mod || exit 1
43 file2
44 EOF
45
46 cat << EOF | cmp - all || exit 1
47 file1
48 file2
49 EOF