diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-06-26 00:13:54 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-06-26 00:37:09 -0500 |
commit | 78787052b6a68c0f54cfa983a69c44276de9daa4 (patch) | |
tree | a3bda9e9d2d3a9b3613c45305e17802a041ac9e5 /lib/locale.t | |
parent | df8a53a3dd89e38abbe84d468df77ae060003e25 (diff) | |
download | perl-78787052b6a68c0f54cfa983a69c44276de9daa4.tar.gz |
use a less broken test for locale radix in atof [perl #109318]
Diffstat (limited to 'lib/locale.t')
-rw-r--r-- | lib/locale.t | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/locale.t b/lib/locale.t index dfc6d2bf0b..26a7bd4d62 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -1247,6 +1247,39 @@ foreach $Locale (@Locale) { print "# failed $locales_test_number locale '$Locale' characters @f\n" } } + + # [perl #109318] + { + my @f = (); + ++$locales_test_number; + $test_names{$locales_test_number} = 'Verify atof with locale radix and negative exponent'; + + my $radix = POSIX::localeconv()->{decimal_point}; + 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", + ); + + if (! $is_utf8_locale) { + use locale; + for my $num (@nums) { + push @f, $num + unless sprintf("%g", $num) =~ /3.+14/; + } + } + else { + use locale ':not_characters'; + for my $num (@nums) { + push @f, $num + unless sprintf("%g", $num) =~ /3.+14/; + } + } + + tryneoalpha($Locale, $locales_test_number, @f == 0); + if (@f) { + print "# failed $locales_test_number locale '$Locale' numbers @f\n" + } + } } my $final_locales_test_number = $locales_test_number; |