Once more unto resync
[p5sagit/p5-mst-13.2.git] / t / pragma / locale.t
index f6b0f2d..6265cce 100755 (executable)
@@ -3,6 +3,7 @@
 BEGIN {
     chdir 't' if -d 't';
     unshift @INC, '../lib';
+    unshift @INC, '.';
     require Config; import Config;
     if (!$Config{d_setlocale} || $Config{ccflags} =~ /\bD?NO_LOCALE\b/) {
        print "1..0\n";
@@ -33,7 +34,7 @@ eval {
 # and mingw32 uses said silly CRT
 $have_setlocale = 0 if $^O eq 'MSWin32' && $Config{cc} =~ /^(cl|gcc)/i;
 
-print "1..", ($have_setlocale ? 115 : 98), "\n";
+print "1..", ($have_setlocale ? 116 : 98), "\n";
 
 use vars qw(&LC_ALL);
 
@@ -77,9 +78,9 @@ check_taint       7, "\L$a";
 check_taint       8, lcfirst($a);
 check_taint       9, "\l$a";
 
-check_taint      10, sprintf('%e', 123.456);
-check_taint      11, sprintf('%f', 123.456);
-check_taint      12, sprintf('%g', 123.456);
+check_taint_not  10, sprintf('%e', 123.456);
+check_taint_not  11, sprintf('%f', 123.456);
+check_taint_not  12, sprintf('%g', 123.456);
 check_taint_not  13, sprintf('%d', 123.456);
 check_taint_not  14, sprintf('%x', 123.456);
 
@@ -241,7 +242,6 @@ Afrikaans:af:za:1 15
 Arabic:ar:dz eg sa:6 arabic8
 Brezhoneg Breton:br:fr:1 15
 Bulgarski Bulgarian:bg:bg:5
-Català Catalan:ca:es:1 15
 Chinese:zh:cn tw:cn.EUC eucCN eucTW euc.CN euc.TW GB2312 tw.EUC
 Hrvatski Croatian:hr:hr:2
 Cymraeg Welsh:cy:cy:1 14 15
@@ -253,24 +253,19 @@ Esperanto:eo:eo:3
 Eesti Estonian:et:ee:4 6 13
 Suomi Finnish:fi:fi:1 15
 Flamish::fl:1 15
-Français French:fr:be ca ch fr lu:1 15
 Deutsch German:de:at be ch de lu:1 15
 Euskaraz Basque:eu:es fr:1 15
-Gáidhlig Gaelic:gd:gb uk:1 14 15
 Galego Galician:gl:es:1 15
 Ellada Greek:el:gr:7 g8
-Føroyskt Faroese:fo:fo:1 15
 Frysk:fy:nl:1 15
 Greenlandic:kl:gl:4 6
 Hebrew:iw:il:8 hebrew8
 Hungarian:hu:hu:2
-Íslensku Icelandic:is:is:1 15
 Indonesian:in:id:1 15
 Gaeilge Irish:ga:IE:1 14 15
 Italiano Italian:it:ch it:1 15
 Nihongo Japanese:ja:jp:euc eucJP jp.EUC sjis
 Korean:ko:kr:
-Sámi Lappish:::4 6 13
 Latine Latin:la:va:1 15
 Latvian:lv:lv:4 6 13
 Lithuanian:lt:lt:4 6 13
@@ -279,13 +274,11 @@ Maltese:mt:mt:3
 Norsk Norwegian:no:no:1 15
 Occitan:oc:es:1 15
 Polski Polish:pl:pl:2
-Português Portuguese:po:po br:1 15
 Rumanian:ro:ro:2
 Russki Russian:ru:ru su ua:5 koi8 koi8r koi8u cp1251
 Serbski Serbian:sr:yu:5
 Slovak:sk:sk:2
 Slovene Slovenian:sl:si:2
-Espanõl Spanish:es:ar bo cl co cr do ec es gt hn mx ni pa pe py sv uy ve:1 15
 Sqhip Albanian:sq:sq:1 15
 Svenska Swedish:sv:fi se:1 15
 Thai:th:th:11 tis620
@@ -293,6 +286,19 @@ Turkish:tr:tr:9 turkish8
 Yiddish:::1 15
 EOF
 
+if ($^O eq 'os390') {
+    $locales =~ s/Svenska Swedish:sv:fi se:1 15\n//;
+    $locales =~ s/Thai:th:th:11 tis620\n//;
+}
+
+sub in_utf8 () { $^H & 0x08 }
+
+if (in_utf8) {
+    require "pragma/locale/utf8";
+} else {
+    require "pragma/locale/latin1";
+}
+
 my @Locale;
 my $Locale;
 my @Alnum_;
@@ -322,6 +328,9 @@ sub decode_encodings {
            push @enc, $_;
        }
     }
+    if ($^O eq 'os390') {
+       push @enc, qw(IBM-037 IBM-819 IBM-1047);
+    }
 
     return @enc;
 }
@@ -379,6 +388,7 @@ my %Problem;
 my %Okay;
 my %Testing;
 my @Neoalpha;
+my %Neoalpha;
 
 sub tryneoalpha {
     my ($Locale, $i, $test) = @_;
@@ -442,6 +452,7 @@ foreach $Locale (@Locale) {
        @Neoalpha = ();
        for (keys %UPPER, keys %lower) {
            push(@Neoalpha, $_) if (/\W/);
+           $Neoalpha{$_} = $_;
        }
     }
 
@@ -633,11 +644,31 @@ foreach $Locale (@Locale) {
                    lcA($x, $y) == 1 && lcB($x, $y) == 1 ||
                    lcA($x, $z) == 0 && lcB($x, $z) == 0);
     }
+
+    debug "# testing 116 with locale '$Locale'\n";
+    {
+       use locale;
+
+       my @f = ();
+       foreach my $x (keys %UPPER) {
+           my $y = lc $x;
+           next unless uc $y eq $x;
+           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;
+           push @f, $x unless $x =~ /$y/i && $y =~ /$x/i;
+       }
+       tryneoalpha($Locale, 116, @f == 0);
+       print "# testing 116 failed for locale '$Locale' for characters @f\n"
+            if @f;
+    }
 }
 
 # Recount the errors.
 
-foreach (99..115) {
+foreach (99..116) {
     if ($Problem{$_} || !defined $Okay{$_} || !@{$Okay{$_}}) {
        if ($_ == 102) {
            print "# The failure of test 102 is not necessarily fatal.\n";
@@ -653,7 +684,7 @@ foreach (99..115) {
 
 my $didwarn = 0;
 
-foreach (99..115) {
+foreach (99..116) {
     if ($Problem{$_}) {
        my @f = sort keys %{ $Problem{$_} };
        my $f = join(" ", @f);