]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: don't skip all uniq tests when locale is missing
authorAssaf Gordon <assafgordon@gmail.com>
Thu, 28 Feb 2013 23:34:49 +0000 (23:34 +0000)
committerPádraig Brady <P@draigBrady.com>
Thu, 28 Feb 2013 23:35:45 +0000 (23:35 +0000)
* tests/misc/uniq.pl: Previously, if LOCALE_FR was not defined, all
tests would be skipped. Modified to skip only the relevant test.

tests/misc/uniq.pl

index 4640b14883dda16582bbe5a1dd85eb179a8d42d5..1d14cd97ff8ea8bc0008a9aa4fc8fb2093d79863 100755 (executable)
@@ -80,23 +80,8 @@ sub add_z_variants($)
   return @new;
 }
 
-# I've only ever triggered the problem in a non-C locale.
-my $locale = $ENV{LOCALE_FR};
-! defined $locale || $locale eq 'none'
-  and CuSkip::skip "$prog: skipping this test -- no appropriate locale\n";
-
-# See if isblank returns true for nbsp.
-my $x = qx!env printf '\xa0'| LC_ALL=$locale tr '[:blank:]' x!;
-# If so, expect just one line of output in the schar test.
-# Otherwise, expect two.
-my $in = " y z\n\xa0 y z\n";
-my $schar_exp = $x eq 'x' ? " y z\n" : $in;
-
 my @Tests =
 (
-  # Test for a subtle, system-and-locale-dependent bug in uniq.
- ['schar', '-f1',  {IN => $in}, {OUT => $schar_exp},
-  {ENV => "LC_ALL=$locale"}],
  ['1', '', {IN=>''}, {OUT=>''}],
  ['2', '', {IN=>"a\na\n"}, {OUT=>"a\n"}],
  ['3', '', {IN=>"a\na"}, {OUT=>"a\n"}],
@@ -244,6 +229,31 @@ my @Tests =
         "Try '$prog --help' for more information.\n"}],
 );
 
+# Locale related tests
+
+my $locale = $ENV{LOCALE_FR};
+if ( defined $locale && $locale ne 'none' )
+  {
+    # I've only ever triggered the problem in a non-C locale.
+
+    # See if isblank returns true for nbsp.
+    my $x = qx!env printf '\xa0'| LC_ALL=$locale tr '[:blank:]' x!;
+    # If so, expect just one line of output in the schar test.
+    # Otherwise, expect two.
+    my $in = " y z\n\xa0 y z\n";
+    my $schar_exp = $x eq 'x' ? " y z\n" : $in;
+
+    my @Locale_Tests =
+    (
+      # Test for a subtle, system-and-locale-dependent bug in uniq.
+      ['schar', '-f1',  {IN => $in}, {OUT => $schar_exp},
+        {ENV => "LC_ALL=$locale"}]
+    );
+
+    push @Tests, @Locale_Tests;
+  }
+
+
 # Set _POSIX2_VERSION=199209 in the environment of each obs-plus* test.
 foreach my $t (@Tests)
   {