]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ptx: check that invalid regular expressions are diagnosed
authorCollin Funk <collin.funk1@gmail.com>
Fri, 12 Jun 2026 04:42:47 +0000 (21:42 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 12 Jun 2026 04:42:47 +0000 (21:42 -0700)
* tests/ptx/ptx.pl (@Tests): Add two test test cases.

tests/ptx/ptx.pl

index 1561996ca6698f7d08e5ac767dc72df56d39d0fe..625a6c6bf6342bef1402301134fc2c5ab30d0cc6 100755 (executable)
@@ -53,6 +53,13 @@ my @Tests =
 ["S-infloop", '-S \^', {IN=>"a\n"}, {EXIT=>1},
                        {ERR_SUBST=>'s/^.*reg.*ex.*length zero.*$/regexlzero/'},
                        {ERR=>"regexlzero\n"}],
+
+["S-bad-regex", '-S [', {IN=>"a\n"}, {EXIT=>1},
+                        {ERR=> ("$prog: Invalid regular " .
+                                "expression (for regexp '[')\n")}],
+["W-bad-regex", '-W [', {IN=>"a\n"}, {EXIT=>1},
+                        {ERR=> ("$prog: Invalid regular " .
+                                "expression (for regexp '[')\n")}],
 );
 
 @Tests = triple_test \@Tests;