From: Karen Etheridge Date: Sat, 9 Aug 2014 03:56:18 +0000 (-0700) Subject: convert raw tests to using Test::More X-Git-Tag: v0.09~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b6375112810eba18892900431273fcf885b598a;p=p5sagit%2FSub-Name.git convert raw tests to using Test::More --- diff --git a/t/RT96893_perlcc.t b/t/RT96893_perlcc.t index ebd8124..b9cdbc8 100644 --- a/t/RT96893_perlcc.t +++ b/t/RT96893_perlcc.t @@ -1,16 +1,13 @@ use strict; use warnings; -eval "require B::C;"; -if ($@) { - print "1..0 # SKIP B::C required for testing perlcc -O3\n"; - exit; -} elsif ($B::C::VERSION lt '1.48') { - print "1..0 # SKIP testing too old B-C-$B::C::VERSION\n"; - exit; -} else { - print "1..1\n"; -} +use Test::More 0.88; + +plan skip_all => 'B::C required for testing perlcc -O3' + unless eval "require B::C;"; + +plan skip_all => "testing too old B-C-$B::C::VERSION" + unless eval { B::C->VERSION('1.48') }; my $f = "t/rt96893x.pl"; open my $fh, ">", $f; END { unlink $f if $f } @@ -20,4 +17,6 @@ close $fh; system($^X, qw(-Mblib -S perlcc -O3 -UCarp -UConfig -r), $f); unlink "t/rt96893x", "t/rt96893x.exe"; + +done_testing; # vim: ft=perl diff --git a/t/smoke.t b/t/smoke.t index 9a5f760..79b8668 100644 --- a/t/smoke.t +++ b/t/smoke.t @@ -1,5 +1,6 @@ -BEGIN { print "1..10\n"; $^P |= 0x210 } +BEGIN { $^P |= 0x210 } +use Test::More 0.88; use Sub::Name; my $x = subname foo => sub { (caller 0)[3] }; @@ -7,36 +8,34 @@ my $line = __LINE__ - 1; my $file = __FILE__; my $anon = $DB::sub{"main::__ANON__[${file}:${line}]"}; -print $x->() eq "main::foo" ? "ok 1\n" : "not ok 1\n"; - +is($x->(), "main::foo"); package Blork; use Sub::Name; subname " Bar!", $x; -print $x->() eq "Blork:: Bar!" ? "ok 2\n" : "not ok 2\n"; +::is($x->(), "Blork:: Bar!"); subname "Foo::Bar::Baz", $x; -print $x->() eq "Foo::Bar::Baz" ? "ok 3\n" : "not ok 3\n"; +::is($x->(), "Foo::Bar::Baz"); subname "subname (dynamic $_)", \&subname for 1 .. 3; for (4 .. 5) { subname "Dynamic $_", $x; - print $x->() eq "Blork::Dynamic $_" ? "ok $_\n" : "not ok $_\n"; + ::is($x->(), "Blork::Dynamic $_"); } -print $DB::sub{"main::foo"} eq $anon ? "ok 6\n" : "not ok 6\n"; +::is($DB::sub{"main::foo"}, $anon); for (4 .. 5) { - print $DB::sub{"Blork::Dynamic $_"} eq $anon ? "ok ".($_+3)."\n" : "not ok ".($_+3)."\n"; + ::is($DB::sub{"Blork::Dynamic $_"}, $anon); } -my $i = 9; for ("Blork:: Bar!", "Foo::Bar::Baz") { - print $DB::sub{$_} eq $anon ? "ok $i\n" : "not ok $_ \n"; - $i++; + ::is($DB::sub{$_}, $anon); } +::done_testing; # vim: ft=perl