>From 65e47a463e672eddf8f7ed0ca5a9886033e0ef69 Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Thu, 28 Feb 2013 14:12:52 -0500 Subject: [PATCH] uniq: don't skip all tests when locale is missing * 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 | 41 ++++++++++++++++++++++++++--------------- 1 files changed, 26 insertions(+), 15 deletions(-) diff --git a/tests/misc/uniq.pl b/tests/misc/uniq.pl index e3873b5..4fe1357 100755 --- a/tests/misc/uniq.pl +++ b/tests/misc/uniq.pl @@ -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"}], @@ -205,6 +190,32 @@ my @Tests = ['127', '--ignore-case', {IN=>"A\na\n"}, {OUT=>"A\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) { -- 1.7.7.4