Skip to content

Commit

Permalink
lib/locale.t: Use I18N::Langinfo, not POSIX::localeconv()
Browse files Browse the repository at this point in the history
Now that Langinfo is ported to every box, it requires less work than
localeconv(), and offers more choices.  This commit changes to use it,
and for more info when debugging, gets some additional info from it.
  • Loading branch information
khwilliamson committed May 5, 2021
1 parent 8d65f91 commit 892c44a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/locale.t
Expand Up @@ -54,6 +54,7 @@ BEGIN {
}

use feature 'fc';
use I18N::Langinfo qw(langinfo CODESET CRNCYSTR RADIXCHAR);

# =1 adds debugging output; =2 increases the verbosity somewhat
our $debug = $ENV{PERL_DEBUG_FULL_TEST} // 0;
Expand Down Expand Up @@ -1052,9 +1053,11 @@ foreach my $Locale (@Locale) {

my $is_utf8_locale = is_locale_utf8($Locale);

debug "code set = " . langinfo(CODESET);
debug "is utf8 locale? = $is_utf8_locale\n";

debug "radix = " . disp_str(localeconv()->{decimal_point}) . "\n";
debug "radix = " . disp_str(langinfo(RADIXCHAR));
debug "currency = " . disp_str(langinfo(CRNCYSTR));

if (! $is_utf8_locale) {
use locale;
Expand Down Expand Up @@ -2429,7 +2432,7 @@ foreach my $Locale (@Locale) {
$test_names{$locales_test_number} = 'Verify atof with locale radix and negative exponent';
$problematical_tests{$locales_test_number} = 1;

my $radix = POSIX::localeconv()->{decimal_point};
my $radix = langinfo(RADIXCHAR);
my @nums = (
"3.14e+9", "3${radix}14e+9", "3.14e-9", "3${radix}14e-9",
"-3.14e+9", "-3${radix}14e+9", "-3.14e-9", "-3${radix}14e-9",
Expand Down

0 comments on commit 892c44a

Please sign in to comment.