]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: tr: add test for invalid character class name
authorSylvestre Ledru <sylvestre@debian.org>
Thu, 19 Mar 2026 21:25:14 +0000 (22:25 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 23 Mar 2026 12:11:35 +0000 (12:11 +0000)
* tests/tr/tr.pl (invalid-class): New test.
Identified : https://github.com/uutils/coreutils/pull/11398
https://github.com/coreutils/coreutils/pull/225

tests/tr/tr.pl

index e07dfa0c722adb638b5e0bfde9cb334982a746c0..dc37e5c19963b15cf7da6f80fa43420cb0dba5fb 100755 (executable)
@@ -158,6 +158,10 @@ my @Tests =
 
   # Up to coreutils-6.9, this would provoke a failed assertion.
   ['no-abort-1', qw(-c a '[b*256]'), {IN=>'abc'}, {OUT=>'abb'}],
+
+  # Reject unknown character class name.
+  ['invalid-class', qw('[:fooclass:]' x), {IN=>'abc'}, {OUT=>''}, {EXIT=>1},
+   {ERR=>"$prog: invalid character class 'fooclass'\n"}],
 );
 
 @Tests = triple_test \@Tests;