summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-12-17 08:12:23 -0700
committerKarl Williamson <khw@cpan.org>2022-12-20 05:53:42 -0700
commit433506b77693f56037df866690c55769c32304e4 (patch)
treed922e249d33aa5b91c44e3d6ad57885ae600d7ec /ext
parentdf08369eedb6c7ccdea859fb0edd7cbfc82930cd (diff)
downloadperl-433506b77693f56037df866690c55769c32304e4.tar.gz
API-test:locale.t: Look for a comma radix locale
Prior to this commit there was code (whose results were ignored) looking for a locale with a non-dot radix. This can result in a UTF-8 radix, which may not display properly without the terminal and file handle being in sync. Almost all non-dot locales use a comma, which is represented the same in UTF-8 as not, so doesn't suffer from the display problem. So look specifically for a comma. The result is still unused, but the next commit will use it.
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-APItest/t/locale.t12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/XS-APItest/t/locale.t b/ext/XS-APItest/t/locale.t
index 424b9d9150..631c522580 100644
--- a/ext/XS-APItest/t/locale.t
+++ b/ext/XS-APItest/t/locale.t
@@ -11,13 +11,15 @@ skip_all("locales not available") unless locales_enabled('LC_NUMERIC');
my @locales = eval { find_locales( &LC_NUMERIC ) };
skip_all("no LC_NUMERIC locales available") unless @locales;
-my $non_dot_locale;
-for (@locales) {
+my $comma_locale;
+for my $locale (@locales) {
+ use POSIX;
use locale;
- setlocale(LC_NUMERIC, $_) or next;
+ setlocale(LC_NUMERIC, $locale) or next;
my $in = 4.2; # avoid any constant folding bugs
- if (sprintf("%g", $in) ne "4.2") {
- $non_dot_locale = $_;
+ my $s = sprintf("%g", $in);
+ if ($s eq "4,2") {
+ $comma_locale = $locale;
last;
}
}