Debian Codegraph @

tests/grepdiff1/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 @@ -0,0 +1 @@
12 ++a
13 --- orig/file2
14 +++ file2
15 @@ -0,0 +1 @@
16 +a
17 --- file3
18 +++ file3.orig
19 @@ -0,0 +1 @@
20 +b
21 EOF
22
23 # Check if PCRE2 is being used by examining the help output
24 if ${GREPDIFF} --help 2>&1 | grep -q "PCRE regexes are used by default"; then
25 # PCRE2 is enabled - need to escape the plus sign
26 PATTERN='\+a'
27 else
28 # Standard regex - plus sign doesn't need escaping
29 PATTERN='+a'
30 fi
31
32 ${GREPDIFF} "$PATTERN" diff 2>errors >index || exit 1
33 [ -s errors ] && exit 1
34
35 cat << EOF | cmp - index || exit 1
36 file1
37 EOF