In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3513da74e0f2c30b5ec85278b6e69f8751be9184?hp=3d47529a635ec9dcd025da807163bb673f622df7>
- Log ----------------------------------------------------------------- commit 3513da74e0f2c30b5ec85278b6e69f8751be9184 Author: Nicholas Clark <[email protected]> Date: Fri Oct 23 20:58:28 2009 +0100 Convert the 2 Storable tests that use Test to use Test::More. M dist/Storable/t/code.t M dist/Storable/t/just_plain_nasty.t commit 08332554c0d06391c67d978a02a96176ca382626 Author: Nicholas Clark <[email protected]> Date: Fri Oct 23 20:52:39 2009 +0100 Convert the Pod::Perldoc tests from Test to Test::More. Not that they test much, other than require of the various modules. M dist/Pod-Perldoc/t/01_about_verbose.t M dist/Pod-Perldoc/t/checkerbasic.t M dist/Pod-Perldoc/t/perldocbasic.t M dist/Pod-Perldoc/t/textbasic.t commit b6703958fc5a9cc56804c26040a6a8aaa7c26dfb Author: Nicholas Clark <[email protected]> Date: Fri Oct 23 20:44:42 2009 +0100 Convert the odd Locale::Maketext test out from Test to Test::More. All the others were using Test::More already. M dist/Locale-Maketext/t/30_local.t ----------------------------------------------------------------------- Summary of changes: dist/Locale-Maketext/t/30_local.t | 16 +++--- dist/Pod-Perldoc/t/01_about_verbose.t | 11 ++-- dist/Pod-Perldoc/t/checkerbasic.t | 7 +-- dist/Pod-Perldoc/t/perldocbasic.t | 7 +-- dist/Pod-Perldoc/t/textbasic.t | 7 +-- dist/Storable/t/code.t | 94 ++++++++++++++++---------------- dist/Storable/t/just_plain_nasty.t | 36 ++++++------ 7 files changed, 86 insertions(+), 92 deletions(-) diff --git a/dist/Locale-Maketext/t/30_local.t b/dist/Locale-Maketext/t/30_local.t index 379197e..8b89777 100644 --- a/dist/Locale-Maketext/t/30_local.t +++ b/dist/Locale-Maketext/t/30_local.t @@ -2,11 +2,10 @@ use strict; -use Test; -BEGIN { plan tests => 4; } +use Test::More tests => 4; use Locale::Maketext; print "# Hi there...\n"; -ok 1; +pass(); print "# --- Making sure that Perl globals are localized ---\n"; @@ -20,13 +19,12 @@ print "# --- Making sure that Perl globals are localized ---\n"; keys %Lexicon; # dodges the 'used only once' warning } -my $lh; -print "# Basic sanity:\n"; -ok defined( $lh = Woozle->new() ) && ref($lh); +my $lh = Woozle->new(); +ok(ref $lh, 'Basic sanity'); -print "# Make sure \$@ is localized...\n"; $@ = 'foo'; -ok $lh && $lh->maketext('Eval error: [_1]', $@), 'Eval error: foo'; +is($lh->maketext('Eval error: [_1]', $@), 'Eval error: foo', + 'Make sure $@ is localized'); print "# Byebye!\n"; -ok 1; +pass(); diff --git a/dist/Pod-Perldoc/t/01_about_verbose.t b/dist/Pod-Perldoc/t/01_about_verbose.t index eb2f411..6a0f30e 100644 --- a/dist/Pod-Perldoc/t/01_about_verbose.t +++ b/dist/Pod-Perldoc/t/01_about_verbose.t @@ -4,12 +4,11 @@ require 5; # Summary of, well, things. -use Test; -BEGIN {plan tests => 2}; +use Test::More tests => 2; -ok 1; - -use Pod::Perldoc; +BEGIN { + use_ok 'Pod::Perldoc'; +} #chdir "t" if -e "t"; @@ -83,5 +82,5 @@ foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) { print "# [$x] = [", $INC{$x} || '', "]\n"; } -ok 1; +pass(); diff --git a/dist/Pod-Perldoc/t/checkerbasic.t b/dist/Pod-Perldoc/t/checkerbasic.t index c47dced..a8d4dc0 100644 --- a/dist/Pod-Perldoc/t/checkerbasic.t +++ b/dist/Pod-Perldoc/t/checkerbasic.t @@ -1,9 +1,8 @@ -use Test; -BEGIN {plan tests => 2}; -ok 1; +use Test::More tests => 2; +pass(); require Pod::Perldoc::ToChecker; $Pod::Perldoc::VERSION and print "# Pod::Perldoc version $Pod::Perldoc::VERSION\n"; -ok 1; +pass(); diff --git a/dist/Pod-Perldoc/t/perldocbasic.t b/dist/Pod-Perldoc/t/perldocbasic.t index 6f6b998..e11b91e 100644 --- a/dist/Pod-Perldoc/t/perldocbasic.t +++ b/dist/Pod-Perldoc/t/perldocbasic.t @@ -1,9 +1,8 @@ -use Test; -BEGIN {plan tests => 3}; -ok 1; +use Test::More tests => 3; +pass(); require Pod::Perldoc; ok($Pod::Perldoc::VERSION) and print "# Pod::Perldoc version $Pod::Perldoc::VERSION\n"; -ok 1; +pass(); diff --git a/dist/Pod-Perldoc/t/textbasic.t b/dist/Pod-Perldoc/t/textbasic.t index 6814267..3ed19a3 100644 --- a/dist/Pod-Perldoc/t/textbasic.t +++ b/dist/Pod-Perldoc/t/textbasic.t @@ -1,9 +1,8 @@ -use Test; -BEGIN {plan tests => 2}; -ok 1; +use Test::More tests => 2; +pass(); require Pod::Perldoc::ToText; $Pod::Perldoc::VERSION and print "# Pod::Perldoc version $Pod::Perldoc::VERSION\n"; -ok 1; +pass(); diff --git a/dist/Storable/t/code.t b/dist/Storable/t/code.t index dd2a96e..a51dffc 100644 --- a/dist/Storable/t/code.t +++ b/dist/Storable/t/code.t @@ -18,7 +18,7 @@ sub BEGIN { use strict; BEGIN { if (!eval q{ - use Test; + use Test::More; use B::Deparse 0.61; use 5.006; 1; @@ -59,7 +59,7 @@ local *FOO; \&Another::Package::foo, # code in another package sub ($$;$) { 0 }, # prototypes sub { print "test\n" }, - \&Test::ok, # large scalar + \&Test::More::ok, # large scalar ], {"a" => sub { "srt" }, "b" => \&code}, @@ -82,44 +82,44 @@ $Storable::Eval = 1; $freezed = freeze $obj[0]; $thawed = thaw $freezed; -ok($thawed->[0]->(), "JAPH"); -ok($thawed->[1]->(), 42); -ok($thawed->[2]->(), "blessed"); -ok($thawed->[3]->(), "Another::Package"); -ok(prototype($thawed->[4]), prototype($obj[0]->[4])); +is($thawed->[0]->(), "JAPH"); +is($thawed->[1]->(), 42); +is($thawed->[2]->(), "blessed"); +is($thawed->[3]->(), "Another::Package"); +is(prototype($thawed->[4]), prototype($obj[0]->[4])); ###################################################################### $freezed = freeze $obj[1]; $thawed = thaw $freezed; -ok($thawed->{"a"}->(), "srt"); -ok($thawed->{"b"}->(), "JAPH"); +is($thawed->{"a"}->(), "srt"); +is($thawed->{"b"}->(), "JAPH"); ###################################################################### $freezed = freeze $obj[2]; $thawed = thaw $freezed; -ok($thawed->(), 42); +is($thawed->(), 42); ###################################################################### $freezed = freeze $obj[3]; $thawed = thaw $freezed; -ok($thawed->(), "JAPH"); +is($thawed->(), "JAPH"); ###################################################################### eval { $freezed = freeze $obj[4] }; -ok($@, qr/The result of B::Deparse::coderef2text was empty/); +like($@, qr/The result of B::Deparse::coderef2text was empty/); ###################################################################### # Test dclone my $new_sub = dclone($obj[2]); -ok($new_sub->(), $obj[2]->()); +is($new_sub->(), $obj[2]->()); ###################################################################### # Test retrieve & store @@ -127,11 +127,11 @@ ok($new_sub->(), $obj[2]->()); store $obj[0], 'store'; $thawed = retrieve 'store'; -ok($thawed->[0]->(), "JAPH"); -ok($thawed->[1]->(), 42); -ok($thawed->[2]->(), "blessed"); -ok($thawed->[3]->(), "Another::Package"); -ok(prototype($thawed->[4]), prototype($obj[0]->[4])); +is($thawed->[0]->(), "JAPH"); +is($thawed->[1]->(), 42); +is($thawed->[2]->(), "blessed"); +is($thawed->[3]->(), "Another::Package"); +is(prototype($thawed->[4]), prototype($obj[0]->[4])); ###################################################################### @@ -139,11 +139,11 @@ nstore $obj[0], 'store'; $thawed = retrieve 'store'; unlink 'store'; -ok($thawed->[0]->(), "JAPH"); -ok($thawed->[1]->(), 42); -ok($thawed->[2]->(), "blessed"); -ok($thawed->[3]->(), "Another::Package"); -ok(prototype($thawed->[4]), prototype($obj[0]->[4])); +is($thawed->[0]->(), "JAPH"); +is($thawed->[1]->(), 42); +is($thawed->[2]->(), "blessed"); +is($thawed->[3]->(), "Another::Package"); +is(prototype($thawed->[4]), prototype($obj[0]->[4])); ###################################################################### # Security with @@ -157,7 +157,7 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); $freezed = freeze $obj[$i]; $@ = ""; eval { $thawed = thaw $freezed }; - ok($@, qr/Can\'t eval/); + like($@, qr/Can\'t eval/); } } @@ -167,7 +167,7 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); for my $i (0 .. 1) { $@ = ""; eval { $freezed = freeze $obj[$i] }; - ok($@, qr/Can\'t store CODE items/); + like($@, qr/Can\'t store CODE items/); } } @@ -178,8 +178,8 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); $freezed = freeze $obj[0]->[$i]; $@ = ""; eval { $thawed = thaw $freezed }; - ok($@, ""); - ok($$thawed, qr/^sub/); + is($@, ""); + like($$thawed, qr/^sub/); } } @@ -197,8 +197,8 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); open(STDERR, ">&SAVEERR"); - ok($@, ""); - ok($freezed ne ''); + is($@, ""); + isnt($freezed, ''); } { @@ -208,13 +208,13 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); $freezed = freeze $obj[0]->[0]; $@ = ""; eval { $thawed = thaw $freezed }; - ok($@, ""); - ok($thawed->(), "JAPH"); + is($@, ""); + is($thawed->(), "JAPH"); $freezed = freeze $obj[0]->[6]; eval { $thawed = thaw $freezed }; # The "Code sub ..." error message only appears if Log::Agent is installed - ok($@, qr/(trapped|Code sub)/); + like($@, qr/(trapped|Code sub)/); if (0) { # Disable or fix this test if the internal representation of Storable @@ -230,7 +230,7 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); substr($freezed, -1, 0, $bad_code); $@ = ""; eval { $thawed = thaw $freezed }; - ok($@, qr/(trapped|Code sub)/); + like($@, qr/(trapped|Code sub)/); } } @@ -243,8 +243,8 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); $freezed = freeze $obj[0]->[1]; $@ = ""; eval { $thawed = thaw $freezed }; - ok($@, ""); - ok($thawed->(), 42); + is($@, ""); + is($thawed->(), 42); } { @@ -265,16 +265,16 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); $freezed = freeze $obj[0]; eval { $thawed = thaw $freezed }; - ok($@, ""); + is($@, ""); if ($@ ne "") { - ok(0) for (1..5); + fail() for (1..5); } else { - ok($thawed->[0]->(), "JAPH"); - ok($thawed->[1]->(), 42); - ok($thawed->[2]->(), "blessed"); - ok($thawed->[3]->(), "Another::Package"); - ok(prototype($thawed->[4]), prototype($obj[0]->[4])); + is($thawed->[0]->(), "JAPH"); + is($thawed->[1]->(), 42); + is($thawed->[2]->(), "blessed"); + is($thawed->[3]->(), "Another::Package"); + is(prototype($thawed->[4]), prototype($obj[0]->[4])); } } @@ -293,15 +293,15 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); my $res; $res = thaw freeze [$sub, $sub]; - ok(int($res->[0]), int($res->[1])); + is(int($res->[0]), int($res->[1])); $res = thaw freeze [$sclr, $sub, $sub, $sclr]; - ok(int($res->[0]), int($res->[3])); - ok(int($res->[1]), int($res->[2])); + is(int($res->[0]), int($res->[3])); + is(int($res->[1]), int($res->[2])); $res = thaw freeze [$sub, $sub, $sclr, $sclr]; - ok(int($res->[0]), int($res->[1])); - ok(int($res->[2]), int($res->[3])); + is(int($res->[0]), int($res->[1])); + is(int($res->[2]), int($res->[3])); } } diff --git a/dist/Storable/t/just_plain_nasty.t b/dist/Storable/t/just_plain_nasty.t index 85eaa90..28fa7e0 100644 --- a/dist/Storable/t/just_plain_nasty.t +++ b/dist/Storable/t/just_plain_nasty.t @@ -17,7 +17,7 @@ sub BEGIN { use strict; BEGIN { if (!eval q{ - use Test; + use Test::More; use B::Deparse 0.61; use 5.006; 1; @@ -64,7 +64,7 @@ for my $dbun (1, 0) { # dbun - don't be utterly nasty - being utterly $a[$dbun]->[0] = $a[0]; - ok(ref($nasty), "ARRAY", "Sanity found (now to play with it :->)"); + is(ref($nasty), "ARRAY", "Sanity found (now to play with it :->)"); $Storable::Deparse = $Storable::Deparse = 1; $Storable::Eval = $Storable::Eval = 1; @@ -74,16 +74,16 @@ for my $dbun (1, 0) { # dbun - don't be utterly nasty - being utterly #print $icicle; # cat -ve recommended :) headit("circular overload 1 - thaw"); my $oh_dear = thaw $icicle; - ok(ref($oh_dear), "ARRAY", "dclone - circular overload"); - ok($oh_dear->[0], "keep it so", "amagic ok 1"); - ok($oh_dear->[$dbun]->[0], "keep it so", "amagic ok 2"); + is(ref($oh_dear), "ARRAY", "dclone - circular overload"); + is($oh_dear->[0], "keep it so", "amagic ok 1"); + is($oh_dear->[$dbun]->[0], "keep it so", "amagic ok 2"); headit("closure dclone - freeze"); $icicle = freeze sub { "two" }; #print $icicle; headit("closure dclone - thaw"); my $sub2 = thaw $icicle; - ok($sub2->(), "two", "closures getting dcloned OK"); + is($sub2->(), "two", "closures getting dcloned OK"); headit("circular overload, after closure - freeze"); #use Data::Dumper; @@ -92,9 +92,9 @@ for my $dbun (1, 0) { # dbun - don't be utterly nasty - being utterly #print $icicle; headit("circular overload, after closure - thaw"); $oh_dear = thaw $icicle; - ok(ref($oh_dear), "ARRAY", "dclone - after a closure dclone"); - ok($oh_dear->[0], "keep it so", "amagic ok 1"); - ok($oh_dear->[$dbun]->[0], "keep it so", "amagic ok 2"); + is(ref($oh_dear), "ARRAY", "dclone - after a closure dclone"); + is($oh_dear->[0], "keep it so", "amagic ok 1"); + is($oh_dear->[$dbun]->[0], "keep it so", "amagic ok 2"); push @{$nasty}, sub { print "Goodbye, cruel world.\n" }; headit("closure freeze AFTER circular overload"); @@ -103,9 +103,9 @@ for my $dbun (1, 0) { # dbun - don't be utterly nasty - being utterly #print $icicle; headit("circular thaw AFTER circular overload"); $oh_dear = thaw $icicle; - ok(ref($oh_dear), "ARRAY", "dclone - before a closure dclone"); - ok($oh_dear->[0], "keep it so", "amagic ok 1"); - ok($oh_dear->[$dbun]->[0], "keep it so", "amagic ok 2"); + is(ref($oh_dear), "ARRAY", "dclone - before a closure dclone"); + is($oh_dear->[0], "keep it so", "amagic ok 1"); + is($oh_dear->[$dbun]->[0], "keep it so", "amagic ok 2"); @{$nasty} = @{$nasty}[0, 2, 1]; headit("closure freeze BETWEEN circular overload"); @@ -114,9 +114,9 @@ for my $dbun (1, 0) { # dbun - don't be utterly nasty - being utterly #print $icicle; headit("circular thaw BETWEEN circular overload"); $oh_dear = thaw $icicle; - ok(ref($oh_dear), "ARRAY", "dclone - between a closure dclone"); - ok($oh_dear->[0], "keep it so", "amagic ok 1"); - ok($oh_dear->[$dbun?2:0]->[0], "keep it so", "amagic ok 2"); + is(ref($oh_dear), "ARRAY", "dclone - between a closure dclone"); + is($oh_dear->[0], "keep it so", "amagic ok 1"); + is($oh_dear->[$dbun?2:0]->[0], "keep it so", "amagic ok 2"); @{$nasty} = @{$nasty}[1, 0, 2]; headit("closure freeze BEFORE circular overload"); @@ -125,9 +125,9 @@ for my $dbun (1, 0) { # dbun - don't be utterly nasty - being utterly #print $icicle; headit("circular thaw BEFORE circular overload"); $oh_dear = thaw $icicle; - ok(ref($oh_dear), "ARRAY", "dclone - after a closure dclone"); - ok($oh_dear->[1], "keep it so", "amagic ok 1"); - ok($oh_dear->[$dbun+1]->[0], "keep it so", "amagic ok 2"); + is(ref($oh_dear), "ARRAY", "dclone - after a closure dclone"); + is($oh_dear->[1], "keep it so", "amagic ok 1"); + is($oh_dear->[$dbun+1]->[0], "keep it so", "amagic ok 2"); } sub headit { -- Perl5 Master Repository
