Debian Codegraph @

tests/select2/run-test

raw
1 #!/bin/sh
2
3 # This is a filterdiff(1) testcase.
4 # Test: Context format, filename pattern but no selector
5
6
7 . ${top_srcdir-.}/tests/common.sh
8
9 cat << EOF > patch
10 *** a.orig
11 --- a
12 ***************
13 *** 1 ****
14 ! a
15 --- 1 ----
16 ! b
17 *** b.orig
18 --- b
19 ***************
20 *** 1 ****
21 ! a
22 --- 1 ----
23 ! b
24 *** c.orig
25 --- c
26 ***************
27 *** 1 ****
28 ! a
29 --- 1 ----
30 ! b
31 EOF
32
33 ${FILTERDIFF} -i b <patch >selected 2>errors || exit 1
34 [ -s errors ] && exit 1
35
36 cat << EOF | cmp - selected || exit 1
37 *** b.orig
38 --- b
39 ***************
40 *** 1 ****
41 ! a
42 --- 1 ----
43 ! b
44 EOF
45
46 cat << EOF > patterns
47 no
48 match
49 EOF
50
51 ${FILTERDIFF} -I patterns <patch >selected 2>errors || exit 1
52 [ -s errors ] && exit 1
53
54 cat << EOF | cmp - selected || exit 1
55 EOF
56
57 cat << EOF > patterns
58 not-a
59 b
60 not-c
61 EOF
62
63 ${FILTERDIFF} -I patterns <patch >selected 2>errors || exit 1
64 [ -s errors ] && exit 1
65
66 cat << EOF | cmp - selected || exit 1
67 *** b.orig
68 --- b
69 ***************
70 *** 1 ****
71 ! a
72 --- 1 ----
73 ! b
74 EOF