]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(c-2, c-2-minus, c2, c2-minus): New tests.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 1 Nov 2005 23:05:52 +0000 (23:05 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 1 Nov 2005 23:05:52 +0000 (23:05 +0000)
(test_vector): Add special cases for _POSIX2_VERSION, and
regularize the old ones a bit.

tests/tail/Test.pm

index c9c38c7ded930dd4ad5f881aad1d7574c95b47b8..354b4f9c12bdf3b1ad7067ecd7384b4d1b4085b9 100755 (executable)
@@ -58,6 +58,11 @@ my @tv = (
 ['minus-1', '-', '', '', 0],
 ['minus-2', '-', "x\n" . ("y\n" x 10) . 'z', ("y\n" x 9) . 'z', 0],
 
+['c-2', '-c 2', "abcd\n", "d\n", 0],
+['c-2-minus', '-c 2 --', "abcd\n", "d\n", 0],
+['c2', '-c2', "abcd\n", "d\n", 0],
+['c2-minus', '-c2 --', "abcd\n", "d\n", 0],
+
 ['n-1', '-n 10', "x\n" . ("y\n" x 10) . 'z', ("y\n" x 9) . 'z', 0],
 ['n-2', '-n -10', "x\n" . ("y\n" x 10) . 'z', ("y\n" x 9) . 'z', 0],
 ['n-3', '-n +10', "x\n" . ("y\n" x 10) . 'z', "y\ny\nz", 0],
@@ -78,17 +83,19 @@ my @tv = (
 
 sub test_vector
 {
-  # With _POSIX2_VERSION=199209, `tail -c' succeeds, but err-6 expects
-  # a failure, so set _POSIX2_VERSION to ensure it fails.
-  $Test::env{'err-6'} = ['_POSIX2_VERSION=200112'];
-
   my $t;
   foreach $t (@tv)
     {
       my ($test_name, $flags, $in, $exp, $ret) = @$t;
 
-      $test_name =~ /^(obs-plus-|minus-)/
-       and $Test::env{$test_name} = ['_POSIX2_VERSION=199209'];
+      if ($test_name =~ /^(obs-plus-|minus-)/)
+        {
+         $Test::env{$test_name} = ['_POSIX2_VERSION=199209'];
+        }
+      if ($test_name =~ /^(err-6|c-2)$/)
+        {
+         $Test::env{$test_name} = ['_POSIX2_VERSION=200112'];
+        }
 
       # If you run the minus* tests with a FILE arg they'd hang.
       # If you run the err-1 or err-3 tests with a FILE, they'd misinterpret