This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bump version to 5.33.5
[perl5.git] / lib / locale.t
index 235fb71..3b4cfcc 100644 (file)
@@ -1,5 +1,8 @@
 #!./perl -wT
 
+use strict;
+use warnings;
+
 # This tests plain 'use locale' and adorned 'use locale ":not_characters"'
 # Because these pragmas are compile time, and I (khw) am trying to test
 # without using 'eval' as much as possible, which might cloud the issue,  the
@@ -50,7 +53,6 @@ BEGIN {
     require Config; import Config;
 }
 
-use strict;
 use feature 'fc';
 
 # =1 adds debugging output; =2 increases the verbosity somewhat
@@ -77,6 +79,12 @@ my %known_bad_locales = (
                           irix => qr/ ^ (?: cs | hu | sk ) $/x,
                           darwin => qr/ ^ lt_LT.ISO8859 /ix,
                           os390 => qr/ ^ italian /ix,
+                          netbsd => qr/\bISO8859-2\b/i,
+
+                          # This may be the same bug as the cygwin below; it's
+                          # generating malformed UTF-8 on the radix being
+                          # mulit-byte
+                          solaris => qr/ ^ ( ar_ | pa_ ) /x,
                         );
 
 # cygwin isn't returning proper radix length in this locale, but supposedly to
@@ -2161,22 +2169,12 @@ foreach my $Locale (@Locale) {
     my $first_c_test = $locales_test_number;
 
     $test_names{++$locales_test_number} = 'Verify that a different locale radix works when doing "==" with a constant';
-    if ($Config{usequadmath}) {
-        print "# Skip: no locale radix with usequadmath ($test_names{$locales_test_number})\n";
-        report_result($Locale, $locales_test_number, 1);
-    } else {
-        report_result($Locale, $locales_test_number, $ok3);
-        $problematical_tests{$locales_test_number} = 1;
-    }
+    report_result($Locale, $locales_test_number, $ok3);
+    $problematical_tests{$locales_test_number} = 1;
 
     $test_names{++$locales_test_number} = 'Verify that a different locale radix works when doing "==" with a scalar';
-    if ($Config{usequadmath}) {
-        print "# Skip: no locale radix with usequadmath ($test_names{$locales_test_number})\n";
-        report_result($Locale, $locales_test_number, 1);
-    } else {
-        report_result($Locale, $locales_test_number, $ok4);
-        $problematical_tests{$locales_test_number} = 1;
-    }
+    report_result($Locale, $locales_test_number, $ok4);
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok5);
     $test_names{$locales_test_number} = 'Verify that a different locale radix works when doing "==" with a scalar and an intervening sprintf';
@@ -2192,13 +2190,8 @@ foreach my $Locale (@Locale) {
     $test_names{$locales_test_number} = 'Verify that "==" with a scalar still works in inner no locale';
 
     $test_names{++$locales_test_number} = 'Verify that "==" with a scalar and an intervening sprintf still works in inner no locale';
-    if ($Config{usequadmath}) {
-        print "# Skip: no locale radix with usequadmath ($test_names{$locales_test_number})\n";
-        report_result($Locale, $locales_test_number, 1);
-    } else {
-        report_result($Locale, $locales_test_number, $ok8);
-        $problematical_tests{$locales_test_number} = 1;
-    }
+    report_result($Locale, $locales_test_number, $ok8);
+    $problematical_tests{$locales_test_number} = 1;
 
     debug "$first_e_test..$locales_test_number: \$e = $e, no locale\n";
 
@@ -2212,13 +2205,8 @@ foreach my $Locale (@Locale) {
     $problematical_tests{$locales_test_number} = 1;
 
     $test_names{++$locales_test_number} = 'Verify that after a no-locale block, a different locale radix still works when doing "==" with a scalar and an intervening sprintf';
-    if ($Config{usequadmath}) {
-        print "# Skip: no locale radix with usequadmath ($test_names{$locales_test_number})\n";
-        report_result($Locale, $locales_test_number, 1);
-    } else {
-        report_result($Locale, $locales_test_number, $ok11);
-        $problematical_tests{$locales_test_number} = 1;
-    }
+    report_result($Locale, $locales_test_number, $ok11);
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok12);
     $test_names{$locales_test_number} = 'Verify that after a no-locale block, a different locale radix can participate in an addition and function call as numeric';
@@ -2236,6 +2224,7 @@ foreach my $Locale (@Locale) {
 
     report_result($Locale, ++$locales_test_number, $ok15);
     $test_names{$locales_test_number} = 'Verify that a number with a UTF-8 radix has a UTF-8 stringification';
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok16);
     $test_names{$locales_test_number} = 'Verify that a sprintf of a number with a UTF-8 radix yields UTF-8';
@@ -2257,7 +2246,7 @@ foreach my $Locale (@Locale) {
                                                       # OS X 10.9.3
 
     report_result($Locale, ++$locales_test_number, $ok21);
-    $test_names{$locales_test_number} = '"$!" is ASCII only outside of locale scope';
+    $test_names{$locales_test_number} = '"$!" is ASCII-only outside of locale scope';
 
     debug "$first_f_test..$locales_test_number: \$f = $f, \$g = $g, back to locale = $Locale\n";
 
@@ -2458,14 +2447,9 @@ foreach my $Locale (@Locale) {
             }
         }
 
-        if ($Config{usequadmath}) {
-            print "# Skip: no locale radix with usequadmath ($Locale)\n";
-            report_result($Locale, $locales_test_number, 1);
-        } else {
-            report_result($Locale, $locales_test_number, @f == 0);
-            if (@f) {
-                print "# failed $locales_test_number locale '$Locale' numbers @f\n"
-            }
+        report_result($Locale, $locales_test_number, @f == 0);
+        if (@f) {
+            print "# failed $locales_test_number locale '$Locale' numbers @f\n"
        }
     }
 }
@@ -2561,7 +2545,7 @@ foreach $test_num ($first_locales_test_number..$final_locales_test_number) {
 
 $test_num = $final_locales_test_number;
 
-unless ( $os =~ m!^(dragonfly|openbsd|bitrig|mirbsd)$! ) {
+if ( ! defined $Config{d_setlocale_accepts_any_locale_name}) {
     # perl #115808
     use warnings;
     my $warned = 0;
@@ -2569,7 +2553,7 @@ unless ( $os =~ m!^(dragonfly|openbsd|bitrig|mirbsd)$! ) {
         $warned = $_[0] =~ /uninitialized/;
     };
     my $z = "y" . setlocale(&POSIX::LC_ALL, "xyzzy");
-    ok($warned, "variable set to setlocale(BAD LOCALE) is considered uninitialized");
+    ok($warned, "variable set to setlocale(\"invalid locale name\") is considered uninitialized");
 }
 
 # Test that tainting and case changing works on utf8 strings.  These tests are