From 46f4bdef6f1ff77b64450b6b423e311c07ca4cb3 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Wed, 5 Feb 2014 07:34:52 -0300 Subject: [PATCH] Fix more tests to work on systems that don't define LC_ALL and friends --- t/loc_tools.pl | 1 + t/run/locale.t | 2 +- t/uni/fold.t | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 1f9bc5f..737e870 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -249,6 +249,7 @@ sub find_utf8_ctype_locale (;$) { # Return the name of locale that core Perl # tries all locales it can find on the # platform my $locales_ref = shift; + return if !defined &POSIX::LC_CTYPE; if (! defined $locales_ref) { my @locales = find_locales(&POSIX::LC_CTYPE()); $locales_ref = \@locales; diff --git a/t/run/locale.t b/t/run/locale.t index fbee2d6..27535e6 100644 --- a/t/run/locale.t +++ b/t/run/locale.t @@ -21,7 +21,7 @@ BEGIN { } use Config; my $have_strtod = $Config{d_strtod} eq 'define'; -my @locales = find_locales( [ LC_ALL, LC_CTYPE, LC_NUMERIC ] ); +my @locales = eval { find_locales( [ &LC_ALL, &LC_CTYPE, &LC_NUMERIC ] ) }; skip_all("no locales available") unless @locales; plan tests => &last; diff --git a/t/uni/fold.t b/t/uni/fold.t index b801b16..94090e9 100644 --- a/t/uni/fold.t +++ b/t/uni/fold.t @@ -456,7 +456,7 @@ my $utf8_locale = find_utf8_ctype_locale(); is(fc("\x{1E9E}"), fc("\x{17F}\x{17F}"), 'fc("\x{1E9E}") eq fc("\x{17F}\x{17F}")'); SKIP: { skip 'Can\'t find a UTF-8 locale', 1 unless defined $utf8_locale; - setlocale(LC_CTYPE, $utf8_locale); + setlocale(&LC_CTYPE, $utf8_locale); is(fc("\x{1E9E}"), "ss", 'fc("\x{1E9E}") eq "ss" in a UTF-8 locale)'); } } @@ -474,7 +474,7 @@ SKIP: { } # These should match the UTF-8 locale values - setlocale(LC_CTYPE, $utf8_locale); + setlocale(&LC_CTYPE, $utf8_locale); use locale; for (0..0xff) { is(fc(chr), $unicode_fc[$_], "In a UTF-8 locale, fc(chr $_) is the same as official Unicode"); -- 2.7.4