diff options
Diffstat (limited to 't')
-rw-r--r-- | t/run/locale.t | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/t/run/locale.t b/t/run/locale.t index 7af7875f8c..47bd1a312c 100644 --- a/t/run/locale.t +++ b/t/run/locale.t @@ -26,15 +26,21 @@ skip_all("no locales available") unless @locales; plan tests => &last; +my $non_C_locale; foreach my $locale (@locales) { - next if $locale eq "C"; - setlocale(LC_NUMERIC, $locale) or next; - isnt(setlocale(LC_NUMERIC), "C", "retrieving current non-C LC_ALL doesn't give 'C'"); - setlocale(LC_ALL, $locale) or next; - isnt(setlocale(LC_ALL), "C", "retrieving current non-C LC_ALL doesn't give 'C'"); + next if $locale eq "C" || $locale eq 'POSIX'; + $non_C_locale = $locale; last; } +SKIP: { + skip("no non-C locale available", 2 ) unless $non_C_locale; + setlocale(LC_NUMERIC, $non_C_locale); + isnt(setlocale(LC_NUMERIC), "C", "retrieving current non-C LC_NUMERIC doesn't give 'C'"); + setlocale(LC_ALL, $non_C_locale); + isnt(setlocale(LC_ALL), "C", "retrieving current non-C LC_ALL doesn't give 'C'"); +} + fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF', use POSIX qw(locale_h); use locale; @@ -104,8 +110,8 @@ SKIP: { } SKIP: { - skip("no locale available where LC_NUMERIC makes a difference", &last - 5 ) - if !$different; # -5 is 3 tests before this block; 2 after + skip("no locale available where LC_NUMERIC makes a difference", &last - 7 ) + if !$different; # -7 is 5 tests before this block; 2 after note("using the '$different' locale for LC_NUMERIC tests"); { local $ENV{LC_NUMERIC} = $different; @@ -418,4 +424,7 @@ EOF } +# IMPORTANT: When adding tests before the following line, be sure to update +# its skip count: +# skip("no locale available where LC_NUMERIC makes a difference", ...) sub last { 37 } |