}
sub casetest {
- my ($base, $spec, @funcs) = @_;
+ my ($already_run, $base, $spec, @funcs) = @_;
# For each provided function run it, and run a version with some extra
# characters afterwards. Use a recycling symbol, as it doesn't change case.
+ # $already_run is the number of extra tests the caller has run before this
+ # call.
my $ballast = chr (0x2672) x 3;
@funcs = map {my $f = $_;
($f,
print "# ", scalar keys %none, " noncase mappings\n";
my $tests =
+ $already_run +
((scalar keys %simple) +
(scalar keys %$spec) +
(scalar keys %none)) * @funcs;
- print "1..$tests\n";
- my $test = 1;
+ my $test = $already_run + 1;
for my $i (sort keys %simple) {
my $w = $simple{$i};
$test++;
}
}
+
+ print "1..$tests\n";
}
1;
require "case.pl";
}
-casetest("Lower", \%utf8::ToSpecLower,
+casetest(0, # No extra tests run here,
+ "Lower", \%utf8::ToSpecLower,
sub { lc $_[0] }, sub { my $a = ""; lc ($_[0] . $a) },
sub { lcfirst $_[0] }, sub { my $a = ""; lcfirst ($_[0] . $a) });
require "case.pl";
}
-casetest("Title", \%utf8::ToSpecTitle, sub { ucfirst $_[0] },
+casetest(0, # No extra tests run here,
+ "Title", \%utf8::ToSpecTitle, sub { ucfirst $_[0] },
sub { my $a = ""; ucfirst ($_[0] . $a) });
require "case.pl";
}
-casetest("Upper", \%utf8::ToSpecUpper, sub { uc $_[0] },
+casetest( 0, # extra tests already run
+ "Upper", \%utf8::ToSpecUpper,
+ sub { uc $_[0] },
sub { my $a = ""; uc ($_[0] . $a) });