summaryrefslogtreecommitdiff
path: root/t/run
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-07-07 15:14:49 -0600
committerKarl Williamson <khw@cpan.org>2014-07-09 08:04:53 -0600
commit49efabc8040649cbf0c684a68cbf2a0c0e4aa7b6 (patch)
tree55ffff5d6534cb3903285f91df02b4a2c6dde23e /t/run
parenta9b8c0d859eab16104a6bea88f11ab111070b501 (diff)
downloadperl-49efabc8040649cbf0c684a68cbf2a0c0e4aa7b6.tar.gz
POSIX::setlocale(LC_NUMERIC) returns proper locale
Commit 4c28b29c7a1549f173177cdf69e91cc1acaa0969 broke calling setlocale with a single parameter and hoping to get the correct LC_NUMERIC property returned from it (including LC_ALL calls). This is because the numeric locale is now kept as C except around the code that wants it to be the underlying locale. It turns out that querying the current locale is such a code area, so LC_NUMERIC is now set to the underlying locale around this.
Diffstat (limited to 't/run')
-rw-r--r--t/run/locale.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/run/locale.t b/t/run/locale.t
index ef88ea61de..7af7875f8c 100644
--- a/t/run/locale.t
+++ b/t/run/locale.t
@@ -25,6 +25,16 @@ my @locales = eval { find_locales( [ &LC_ALL, &LC_CTYPE, &LC_NUMERIC ] ) };
skip_all("no locales available") unless @locales;
plan tests => &last;
+
+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'");
+ last;
+}
+
fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF',
use POSIX qw(locale_h);
use locale;
@@ -408,4 +418,4 @@ EOF
}
-sub last { 35 }
+sub last { 37 }