In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/72d70e5644e8e9254a0e459933aaaec0b6fa01b3?hp=e8fbc27bb8213e8bc971fbce5f4c90f2e391293a>
- Log ----------------------------------------------------------------- commit 72d70e5644e8e9254a0e459933aaaec0b6fa01b3 Author: Nicholas Clark <[email protected]> Date: Mon Mar 14 11:29:19 2011 +0000 Convert t/re/regexp_unicode_prop.t to using test.pl's functions for testing. ----------------------------------------------------------------------- Summary of changes: t/re/regexp_unicode_prop.t | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/t/re/regexp_unicode_prop.t b/t/re/regexp_unicode_prop.t index ee65dbd..54a2e7e 100644 --- a/t/re/regexp_unicode_prop.t +++ b/t/re/regexp_unicode_prop.t @@ -169,15 +169,13 @@ push @CLASSES => "# Short properties" => %SHORT_PROPERTIES, my $count = 0; for (my $i = 0; $i < @CLASSES; $i += 2) { $i ++, redo if $CLASSES [$i] =~ /^\h*#\h*(.*)/; - $count += (length $CLASSES [$i] == 1 ? 4 : 2) * @{$CLASSES [$i + 1]}; + $count += 2 * (length $CLASSES [$i] == 1 ? 4 : 2) * @{$CLASSES [$i + 1]}; } -$count += 2 * @ILLEGAL_PROPERTIES; -$count += 2 * grep {length $_ == 1} @ILLEGAL_PROPERTIES; -$count += 4 * @USER_CASELESS_PROPERTIES; +$count += 4 * @ILLEGAL_PROPERTIES; +$count += 4 * grep {length $_ == 1} @ILLEGAL_PROPERTIES; +$count += 8 * @USER_CASELESS_PROPERTIES; -my $tests = 0; - -say "1..$count"; +plan(tests => $count); run_tests unless caller (); @@ -205,13 +203,13 @@ sub match { undef $@; my $match_pat = eval "qr/$match/$caseless"; - print "not " if $@ || ! ($str =~ /$match_pat/); - print "ok ", ++ $tests, " - $name =~ $match_pat\n"; + is($@, '', "$name compiled correctly to a regexp"); + like($str, $match_pat, "$name correctly matched"); undef $@; my $nomatch_pat = eval "qr/$nomatch/$caseless"; - print "not " if $@ || ! ($str !~ /$nomatch_pat/); - print "ok ", ++ $tests, " - $name !~ $nomatch_pat\n"; + is($@, '', "$name compiled correctly to a regexp"); + unlike($str, $nomatch_pat, "$name correctly did not match"); } sub run_tests { @@ -247,21 +245,21 @@ sub run_tests { foreach my $p (@ILLEGAL_PROPERTIES) { undef $@; my $r = eval "'a' =~ /\\p{$p}/; 1"; - print "not " unless !$r && $@ && $@ =~ $pat; - print "ok ", ++ $tests, " - Unknown Unicode property \\p{$p}\n"; + is($r, undef, "Unknown Unicode property \\p{$p}"); + like($@, $pat, "Unknown Unicode property \\p{$p}"); undef $@; my $s = eval "'a' =~ /\\P{$p}/; 1"; - print "not " unless !$s && $@ && $@ =~ $pat; - print "ok ", ++ $tests, " - Unknown Unicode property \\P{$p}\n"; + is($s, undef, "Unknown Unicode property \\p{$p}"); + like($@, $pat, "Unknown Unicode property \\p{$p}"); if (length $p == 1) { undef $@; my $r = eval "'a' =~ /\\p$p/; 1"; - print "not " unless !$r && $@ && $@ =~ $pat; - print "ok ", ++ $tests, " - Unknown Unicode property \\p$p\n"; + is($r, undef, "Unknown Unicode property \\p$p"); + like($@, $pat, "Unknown Unicode property \\p$p"); undef $@; my $s = eval "'a' =~ /\\P$p/; 1"; - print "not " unless !$s && $@ && $@ =~ $pat; - print "ok ", ++ $tests, " - Unknown Unicode property \\P$p\n"; + is($r, undef, "Unknown Unicode property \\P$p"); + like($@, $pat, "Unknown Unicode property \\P$p"); } } -- Perl5 Master Repository
