lib/locale.t: Make more tests not fail unless is bad for enough locales
authorKarl Williamson <public@khwilliamson.com>
Mon, 24 Feb 2014 19:00:03 +0000 (12:00 -0700)
committerKarl Williamson <public@khwilliamson.com>
Tue, 25 Feb 2014 05:38:06 +0000 (22:38 -0700)
locale.t has some tests that fail even one locale fails; and it has some
tests where failure doesn't happen unless a sufficient percentage of
locales have the same problem.

The first set should be for tests whose failure indicates a basic
problem in locale handling; and the second set should be for tests where
it could be that just a locale definition is bad.

Prior to this patch, tests dealing with radix problems were considered
in the first category, but in fact it's possible that just the locale
definition for the radix is wrong.  This is what happened for some older
Darwin versions for their Basque locales, which caused locale.t to show
failures, whereas it was just these locales that were bad, and the
generic handling was ok, or good enough.  (The actual failures had the
radix be the two character string: apostrophe followed by a blank.  It
would be a lot of work to make Perl deal with having a quote character
also mean a decimal point, and that work isn't worth it, especially as
this was a locale definition error, and we don't know of any locale in
the world where an apostrophe is legitimately a radix character.)

For this commit, I looked through the tests, and I added the tests where
it seemed that the problem could just be a bad locale definition to the
list of such tests.  Note that failures here could mean an internal Perl
error, but in that case, it should affect many more locales, so will
show up anyway as the failure rate should exceed the acceptable one.

lib/locale.t

index ae92eec..2b1724c 100644 (file)
@@ -1621,12 +1621,15 @@ foreach my $Locale (@Locale) {
 
     report_result($Locale, ++$locales_test_number, $ok3);
     $test_names{$locales_test_number} = 'Verify that a different locale radix works when doing "==" with a constant';
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok4);
     $test_names{$locales_test_number} = 'Verify that a different locale radix works when doing "==" with a scalar';
+    $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';
+    $problematical_tests{$locales_test_number} = 1;
 
     debug "# $first_c_test..$locales_test_number: \$c = $c, \$d = $d, Locale = $Locale\n";
 
@@ -1639,24 +1642,30 @@ foreach my $Locale (@Locale) {
 
     report_result($Locale, ++$locales_test_number, $ok8);
     $test_names{$locales_test_number} = 'Verify that "==" with a scalar and an intervening sprintf still works in inner no locale';
+    $problematical_tests{$locales_test_number} = 1;
 
     debug "# $first_e_test..$locales_test_number: \$e = $e, no locale\n";
 
     report_result($Locale, ++$locales_test_number, $ok9);
     $test_names{$locales_test_number} = 'Verify that after a no-locale block, a different locale radix still works when doing "==" with a constant';
+    $problematical_tests{$locales_test_number} = 1;
     my $first_f_test = $locales_test_number;
 
     report_result($Locale, ++$locales_test_number, $ok10);
     $test_names{$locales_test_number} = 'Verify that after a no-locale block, a different locale radix still works when doing "==" with a scalar';
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok11);
     $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';
+    $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';
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok13);
     $test_names{$locales_test_number} = 'Verify that don\'t get warning under "==" even if radix is not a dot';
+    $problematical_tests{$locales_test_number} = 1;
 
     report_result($Locale, ++$locales_test_number, $ok14);
     $test_names{$locales_test_number} = 'Verify that non-ASCII UTF-8 error messages are in UTF-8';
@@ -1849,6 +1858,7 @@ foreach my $Locale (@Locale) {
         my @f = ();
         ++$locales_test_number;
         $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 @nums = (