14 my %todo_pass = map { $_ => 1 }
15 qw(00DF 1E9E FB00 FB01 FB02 FB03 FB04 FB05 FB06);
17 my $file="../lib/unicore/CaseFolding.txt";
18 open my $fh,"<",$file or die "Failed to read '$file': $!";
21 my ($line,$comment)= split/\s+#\s+/, $_;
22 my ($cp,$type,@folded)=split/[\s;]+/,$line||'';
23 next unless $type and ($type eq 'F' or $type eq 'C');
24 my $fold_above_latin1 = grep { hex("0x$_") > 255 } @folded;
25 $_="\\x{$_}" for @folded;
29 foreach my $swap (0, 1) { # swap lhs and rhs, or not.
30 foreach my $charclass (0, 1) { # Put rhs in [...], or not
34 $lhs = join "", @folded;
36 $rhs = "[$rhs]" if $charclass;
40 foreach my $rhs_char (@folded) {
41 $rhs .= '[' if $charclass;
43 $rhs .= ']' if $charclass;
49 # Try both Latin1 and Unicode for code points below 256
50 foreach my $upgrade ("", 'utf8::upgrade($c); ') {
52 next if $swap && $fold_above_latin1;
53 next if !$swap && $cpv > 255;
55 my $eval = "my \$c = $lhs; $upgrade\$c =~ $rhs";
56 #print __LINE__, ": $eval\n";
57 push @tests, qq[ok(eval '$eval', '$eval - $comment')];
58 if (! $swap && ($cp eq '0390' || $cp eq '03B0')) {
59 $tests[-1]="TODO: { local \$::TODO='[13:41] <BinGOs> cue *It is all Greek to me* joke.';\n$tests[-1] }"
60 } elsif ($charclass && @folded > 1 && $swap && ! $upgrade && ! $fold_above_latin1) {
61 $tests[-1]="TODO: { local \$::TODO='Multi-char, non-utf8 folded inside character class [ ] doesnt work';\n$tests[-1] }"
62 } elsif (! $upgrade && $cpv >= 128 && $cpv <= 255 && $cpv != 0xb5) {
63 $tests[-1]="TODO: { local \$::TODO='Most non-utf8 latin1 doesnt work';\n$tests[-1] }"
64 } elsif (! $swap && $charclass && @folded > 1
67 # There are a few of these that pass; most fail.
68 $tests[-1]="TODO: { local \$::TODO='Some multi-char, f8 folded inside character class [ ] doesnt work';\n$tests[-1] }"
75 eval join ";\n","plan tests=>".($count-1),@tests,"1"