Debian Codegraph @

tests/grepdiff4/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.orig
10 --- file1
11 ***************
12 *** 1 ****
13 ! A
14 --- 1,2 ----
15 ! a
16 ! b
17 *** 10 ****
18 ! C
19 --- 11,12 ----
20 ! c
21 ! d
22 EOF
23
24 ${GREPDIFF} --output-matching=file 'c' diff 2>errors >file || exit 1
25 ${GREPDIFF} --output-matching=hunk 'c' diff 2>errors >hunk || exit 1
26 [ -s errors ] && exit 1
27
28 cat << EOF | cmp - file || exit 1
29 *** file1.orig
30 --- file1
31 ***************
32 *** 1 ****
33 ! A
34 --- 1,2 ----
35 ! a
36 ! b
37 ***************
38 *** 10 ****
39 ! C
40 --- 11,12 ----
41 ! c
42 ! d
43 EOF
44
45 cat << EOF | cmp - hunk || exit 1
46 *** file1.orig
47 --- file1
48 ***************
49 *** 10 ****
50 ! C
51 --- 10,11 ----
52 ! c
53 ! d
54 EOF