diff options
-rw-r--r-- | tests/Makefile.am | 5 | ||||
-rwxr-xr-x | tests/filename-lineno.pl | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 83e7087f..034bd0c3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -224,6 +224,11 @@ TESTS_ENVIRONMENT = \ }; \ fi; \ \ + : 'set this envvar to indicate whether -P works'; \ + m=0; if err=`echo .|grep -Pq . 2>&1`; then \ + test -z "$$err" && m=1; fi; \ + export PCRE_WORKS=$$m; \ + \ : 'Test egrep/fgrep help if they use our grep.'; \ grep=`echo grep | sed -e '$(transform)'` || exit; \ if test "$$grep" = grep; then \ diff --git a/tests/filename-lineno.pl b/tests/filename-lineno.pl index be927ef4..82b48cd8 100755 --- a/tests/filename-lineno.pl +++ b/tests/filename-lineno.pl @@ -97,6 +97,19 @@ my @Tests = ['invalid-re-G-star-paren', '-G "a.*\\)"', {EXIT=>2}, {ERR => "$prog: Unmatched ) or \\)\n"}, ], + ['invalid-re-P-paren', '-P ")"', {EXIT=>2}, + {ERR => $ENV{PCRE_WORKS} == 1 + ? "$prog: unmatched parentheses\n" + : "Perl matching not supported in a --disable-perl-regexp build\n" + }, + ], + ['invalid-re-P-star-paren', '-P "a.*)"', {EXIT=>2}, + {ERR => $ENV{PCRE_WORKS} == 1 + ? "$prog: unmatched parentheses\n" + : "Perl matching not supported in a --disable-perl-regexp build\n" + }, + ], + ); my $save_temps = $ENV{DEBUG}; |