diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-09-18 14:49:51 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-09-18 14:51:53 -0700 |
commit | 220bd3882cb32b8830dcc742e46aaa93a8c8f9e5 (patch) | |
tree | 300499790d2589710c951d759b6e3454d30de7c1 /tests/filename-lineno.pl | |
parent | b6d95a4e6b57cd260040fb83f828e81b01acd720 (diff) | |
download | grep-220bd3882cb32b8830dcc742e46aaa93a8c8f9e5.tar.gz |
grep: "grep '\)'" reports an error again
* src/grep.c (try_fgrep_pattern): With -G, pass \) through to
GEAcompile so that it can complain. This fixes an unexpected
change in behavior from grep 3.4 and earlier.
* tests/filename-lineno.pl: Add tests for this sort of thing.
Diffstat (limited to 'tests/filename-lineno.pl')
-rwxr-xr-x | tests/filename-lineno.pl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/filename-lineno.pl b/tests/filename-lineno.pl index 8940b1c7..ebd8d1ec 100755 --- a/tests/filename-lineno.pl +++ b/tests/filename-lineno.pl @@ -87,6 +87,22 @@ my @Tests = $err_subst, {ERR => "$prog: Unmatched [...\n" x 2}, ], + + # Test unmatched ) as well. It is OK with -E and an error with -G and -P. + ['invalid-re-E-paren', '-E ")"', {IN=>''}, {EXIT=>1}], + ['invalid-re-E-star-paren', '-E ".*)"', {IN=>''}, {EXIT=>1}], + ['invalid-re-G-paren', '-G "\\)"', {EXIT=>2}, + {ERR => "$prog: Unmatched ) or \\)\n"}, + ], + ['invalid-re-G-star-paren', '-G "a.*\\)"', {EXIT=>2}, + {ERR => "$prog: Unmatched ) or \\)\n"}, + ], + ['invalid-re-P-paren', '-P ")"', {EXIT=>2}, + {ERR => "$prog: unmatched parentheses\n"}, + ], + ['invalid-re-P-star-paren', '-P "a.*)"', {EXIT=>2}, + {ERR => "$prog: unmatched parentheses\n"}, + ], ); my $save_temps = $ENV{DEBUG}; |