X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsmoke.t;h=79b8668b2e27a8ff1107163ea6d0db2d0e0f8ef9;hb=2b6375112810eba18892900431273fcf885b598a;hp=87508ed6e6f3fd17a46fd6f49d799e277ba6acbc;hpb=979516cc8e7e4004baeafaf1afb5bf4069401c5d;p=p5sagit%2FSub-Name.git diff --git a/t/smoke.t b/t/smoke.t index 87508ed..79b8668 100644 --- a/t/smoke.t +++ b/t/smoke.t @@ -1,29 +1,41 @@ -#!/usr/bin/perl - -BEGIN { print "1..5\n"; } - +BEGIN { $^P |= 0x210 } +use Test::More 0.88; use Sub::Name; my $x = subname foo => sub { (caller 0)[3] }; -print $x->() eq "main::foo" ? "ok 1\n" : "not ok 1\n"; +my $line = __LINE__ - 1; +my $file = __FILE__; +my $anon = $DB::sub{"main::__ANON__[${file}:${line}]"}; +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 $_"); +} + +::is($DB::sub{"main::foo"}, $anon); + +for (4 .. 5) { + ::is($DB::sub{"Blork::Dynamic $_"}, $anon); +} + +for ("Blork:: Bar!", "Foo::Bar::Baz") { + ::is($DB::sub{$_}, $anon); } +::done_testing; # vim: ft=perl