Add more backtracking control verbs to regex engine (?CUT), (?ERROR)
[p5sagit/p5-mst-13.2.git] / t / uni / case.pl
index f12e482..e27771b 100644 (file)
@@ -8,6 +8,18 @@ sub unidump {
 
 sub casetest {
     my ($base, $spec, @funcs) = @_;
+    # For each provided function run it, and run a version with some extra
+    # characters afterwards. Use a recylcing symbol, as it doesn't change case.
+    my $ballast = chr (0x2672) x 3;
+    @funcs = map {my $f = $_;
+                 ($f,
+                  sub {my $r = $f->($_[0] . $ballast); # Add it before
+                       $r =~ s/$ballast\z//so # Remove it afterwards
+                           or die "'$_[0]' to '$r' mangled";
+                       $r; # Result with $ballast removed.
+                   },
+                  )} @funcs;
+
     my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir,
                                                      "lib", "unicore", "To"),
                                   "$base.pl");
@@ -66,6 +78,9 @@ sub casetest {
 
     for my $i (sort keys %$spec) {
        my $w = unidump($spec->{$i});
+       if (ord('A') == 193 && $i eq "\x8A\x73") {
+           $w = '0178'; # It's a latin small Y with diaresis and not a latin small letter sharp 's'.
+       }
        my $u = unpack "C0U", $i;
        my $h = sprintf "%04X", $u;
        my $c = chr($u); $c .= chr(0x100); chop $c;
@@ -106,7 +121,7 @@ sub casetest {
                #
                # 0130 -> 0069 0307 (00D1 0307)
                #
-               if ($i =~ /^(0130|0149|01F0|1E96|1E97|1E98|1E99|1E9A)$/) {
+               if ($h =~ /^(0130|0149|01F0|1E96|1E97|1E98|1E99|1E9A)$/) {
                    $e =~ s/004E/002B/; # N
                    $e =~ s/004A/00A2/; # J
                    $e =~ s/0048/00E7/; # H