Skip to content

Commit 1208a63

Browse files
committed
Make grepdiff1 test-case pcre-aware
The test case needs a different pattern when configured with/without pcre2. Fixed: #61 Assisted-by: Cursor
1 parent fcf9dc1 commit 1208a63

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/grepdiff1/run-test

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ cat << EOF > diff
2020
+b
2121
EOF
2222

23-
${GREPDIFF} '\+a' diff 2>errors >index || exit 1
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
2433
[ -s errors ] && exit 1
2534

2635
cat << EOF | cmp - index || exit 1

0 commit comments

Comments
 (0)