- foreach my $x (keys %UPPER) {
- my $y = lc $x;
- next unless uc $y eq $x;
- print "# UPPER $x lc $y ",
- $x =~ /$y/i ? 1 : 0, " ",
- $y =~ /$x/i ? 1 : 0, "\n" if 0;
- #
- # If $x and $y contain regular expression characters
- # AND THEY lowercase (/i) to regular expression characters,
- # regcomp() will be mightily confused. No, the \Q doesn't
- # help here (maybe regex engine internal lowercasing
- # is done after the \Q?) An example of this happening is
- # the bg_BG (Bulgarian) locale under EBCDIC (OS/390 USS):
- # the chr(173) (the "[") is the lowercase of the chr(235).
- #
- # Similarly losing EBCDIC locales include cs_cz, cs_CZ,
- # el_gr, el_GR, en_us.IBM-037 (!), en_US.IBM-037 (!),
- # et_ee, et_EE, hr_hr, hr_HR, hu_hu, hu_HU, lt_LT,
- # mk_mk, mk_MK, nl_nl.IBM-037, nl_NL.IBM-037,
- # pl_pl, pl_PL, ro_ro, ro_RO, ru_ru, ru_RU,
- # sk_sk, sk_SK, sl_si, sl_SI, tr_tr, tr_TR.
- #
- # Similar things can happen even under (bastardised)
- # non-EBCDIC locales: in many European countries before the
- # advent of ISO 8859-x nationally customised versions of
- # ISO 646 were devised, reusing certain punctuation
- # characters for modified characters needed by the
- # country/language. For example, the "|" might have
- # stood for U+00F6 or LATIN SMALL LETTER O WITH DIAERESIS.
- #
- if ($x =~ $re || $y =~ $re) {
- print "# Regex characters in '$x' or '$y', skipping test 117 for locale '$Locale'\n";
- next;
- }
- # With utf8 both will fail since the locale concept
- # of upper/lower does not work well in Unicode.
- push @f, $x unless $x =~ /$y/i == $y =~ /$x/i;
-
- foreach my $x (keys %lower) {
- my $y = uc $x;
- next unless lc $y eq $x;
- print "# lower $x uc $y ",
- $x =~ /$y/i ? 1 : 0, " ",
- $y =~ /$x/i ? 1 : 0, "\n" if 0;
- if ($x =~ $re || $y =~ $re) { # See above.
- print "# Regex characters in '$x' or '$y', skipping test 117 for locale '$Locale'\n";
- next;
- }
- # With utf8 both will fail since the locale concept
- # of upper/lower does not work well in Unicode.
- push @f, $x unless $x =~ /$y/i == $y =~ /$x/i;
- }
- tryneoalpha($Locale, 117, @f == 0);
- if (@f) {
- print "# failed 117 locale '$Locale' characters @f\n"
- }
+ ++$locales_test_number;
+ $test_names{$locales_test_number} = 'Verify case insensitive matching works';
+ foreach my $x (sort keys %UPPER) {
+ if (! $is_utf8_locale) {
+ my $y = lc $x;
+ next unless uc $y eq $x;
+ print "# UPPER $x lc $y ",
+ $x =~ /$y/i ? 1 : 0, " ",
+ $y =~ /$x/i ? 1 : 0, "\n" if 0;
+ #
+ # If $x and $y contain regular expression characters
+ # AND THEY lowercase (/i) to regular expression characters,
+ # regcomp() will be mightily confused. No, the \Q doesn't
+ # help here (maybe regex engine internal lowercasing
+ # is done after the \Q?) An example of this happening is
+ # the bg_BG (Bulgarian) locale under EBCDIC (OS/390 USS):
+ # the chr(173) (the "[") is the lowercase of the chr(235).
+ #
+ # Similarly losing EBCDIC locales include cs_cz, cs_CZ,
+ # el_gr, el_GR, en_us.IBM-037 (!), en_US.IBM-037 (!),
+ # et_ee, et_EE, hr_hr, hr_HR, hu_hu, hu_HU, lt_LT,
+ # mk_mk, mk_MK, nl_nl.IBM-037, nl_NL.IBM-037,
+ # pl_pl, pl_PL, ro_ro, ro_RO, ru_ru, ru_RU,
+ # sk_sk, sk_SK, sl_si, sl_SI, tr_tr, tr_TR.
+ #
+ # Similar things can happen even under (bastardised)
+ # non-EBCDIC locales: in many European countries before the
+ # advent of ISO 8859-x nationally customised versions of
+ # ISO 646 were devised, reusing certain punctuation
+ # characters for modified characters needed by the
+ # country/language. For example, the "|" might have
+ # stood for U+00F6 or LATIN SMALL LETTER O WITH DIAERESIS.
+ #
+ if ($x =~ $re || $y =~ $re) {
+ print "# Regex characters in '$x' or '$y', skipping test $locales_test_number for locale '$Locale'\n";
+ next;
+ }
+ # With utf8 both will fail since the locale concept
+ # of upper/lower does not work well in Unicode.
+ push @f, $x unless $x =~ /$y/i == $y =~ /$x/i;
+
+ # fc is not a locale concept, so Perl uses lc for it.
+ push @f, $x unless lc $x eq fc $x;
+ }
+ else {
+ use locale ':not_characters';
+ my $y = lc $x;
+ next unless uc $y eq $x;
+ print "# UPPER $x lc $y ",
+ $x =~ /$y/i ? 1 : 0, " ",
+ $y =~ /$x/i ? 1 : 0, "\n" if 0;
+
+ # Here, we can fully test things, unlike plain 'use locale',
+ # because this form does work well with Unicode
+ push @f, $x unless $x =~ /$y/i && $y =~ /$x/i;
+
+ # The places where Unicode's lc is different from fc are
+ # skipped here by virtue of the 'next unless uc...' line above
+ push @f, $x unless lc $x eq fc $x;
+ }
+ }
+
+ foreach my $x (sort keys %lower) {
+ if (! $is_utf8_locale) {
+ my $y = uc $x;
+ next unless lc $y eq $x;
+ print "# lower $x uc $y ",
+ $x =~ /$y/i ? 1 : 0, " ",
+ $y =~ /$x/i ? 1 : 0, "\n" if 0;
+ if ($x =~ $re || $y =~ $re) { # See above.
+ print "# Regex characters in '$x' or '$y', skipping test $locales_test_number for locale '$Locale'\n";
+ next;
+ }
+ # With utf8 both will fail since the locale concept
+ # of upper/lower does not work well in Unicode.
+ push @f, $x unless $x =~ /$y/i == $y =~ /$x/i;
+
+ push @f, $x unless lc $x eq fc $x;
+ }
+ else {
+ use locale ':not_characters';
+ my $y = uc $x;
+ next unless lc $y eq $x;
+ print "# lower $x uc $y ",
+ $x =~ /$y/i ? 1 : 0, " ",
+ $y =~ /$x/i ? 1 : 0, "\n" if 0;
+ push @f, $x unless $x =~ /$y/i && $y =~ /$x/i;
+
+ push @f, $x unless lc $x eq fc $x;
+ }
+ }
+ tryneoalpha($Locale, $locales_test_number, @f == 0);
+ if (@f) {
+ 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/;
+ }