X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsmoke.t;h=d5ab2179a7ac12232d9ed984cde205444c7e796f;hb=HEAD;hp=9a5f7602760bb8ba3a2e8b22fd50e3e68784ea08;hpb=cf5ba4372585b0f390ad72d025c09f9ec25e76b2;p=p5sagit%2FSub-Name.git diff --git a/t/smoke.t b/t/smoke.t index 9a5f760..d5ab217 100644 --- a/t/smoke.t +++ b/t/smoke.t @@ -1,5 +1,9 @@ -BEGIN { print "1..10\n"; $^P |= 0x210 } +use strict; +use warnings; +BEGIN { $^P |= 0x210 } + +use Test::More tests => 10; use Sub::Name; my $x = subname foo => sub { (caller 0)[3] }; @@ -7,36 +11,33 @@ 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"; + subname "Dynamic $_", $x; + ::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); } # vim: ft=perl