diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2010-06-02 15:04:16 -0600 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-06-15 12:30:18 +0200 |
commit | cc70200b5f52ae10e2985e4d11670b3b76984b4d (patch) | |
tree | fe78ab937d8ced4e2e48e6baef6e87c0cc34b3fa /t | |
parent | f686127b43eb3c08a5cb1fccce5ef34212234df5 (diff) | |
download | perl-cc70200b5f52ae10e2985e4d11670b3b76984b4d.tar.gz |
t/uni/case.pl: allow extra tests of different form
Add an option to case.pl so that the callers can run extra tests that
don't fit in with it's format. They just pass the number run to it, and
it adjusts the plan accordingly.
Diffstat (limited to 't')
-rw-r--r-- | t/uni/case.pl | 10 | ||||
-rw-r--r-- | t/uni/lower.t | 3 | ||||
-rw-r--r-- | t/uni/title.t | 3 | ||||
-rw-r--r-- | t/uni/upper.t | 4 |
4 files changed, 14 insertions, 6 deletions
diff --git a/t/uni/case.pl b/t/uni/case.pl index c42887f07d..fcb43de5db 100644 --- a/t/uni/case.pl +++ b/t/uni/case.pl @@ -7,9 +7,11 @@ sub unidump { } 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, @@ -57,12 +59,12 @@ sub casetest { 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}; @@ -152,6 +154,8 @@ sub casetest { $test++; } } + + print "1..$tests\n"; } 1; diff --git a/t/uni/lower.t b/t/uni/lower.t index 76df6de09d..5ab4cdd74e 100644 --- a/t/uni/lower.t +++ b/t/uni/lower.t @@ -4,6 +4,7 @@ BEGIN { 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) }); diff --git a/t/uni/title.t b/t/uni/title.t index ae85f94fbb..3d2eb3e251 100644 --- a/t/uni/title.t +++ b/t/uni/title.t @@ -4,5 +4,6 @@ BEGIN { 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) }); diff --git a/t/uni/upper.t b/t/uni/upper.t index d9f1788c72..4229cfeb76 100644 --- a/t/uni/upper.t +++ b/t/uni/upper.t @@ -4,5 +4,7 @@ BEGIN { 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) }); |