For each test function, test it as is, and with extra data appended
Nicholas Clark [Mon, 7 Nov 2005 15:18:51 +0000 (15:18 +0000)]
after each test character.

p4raw-id: //depot/perl@26036

t/uni/case.pl

index f12e482..aad638d 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");