improve wording of this skip message
[p5sagit/Sub-Name.git] / t / smoke.t
CommitLineData
2b637511 1BEGIN { $^P |= 0x210 }
16c23894 2
2b637511 3use Test::More 0.88;
16c23894 4use Sub::Name;
5
6my $x = subname foo => sub { (caller 0)[3] };
3967e628 7my $line = __LINE__ - 1;
8my $file = __FILE__;
9my $anon = $DB::sub{"main::__ANON__[${file}:${line}]"};
10
2b637511 11is($x->(), "main::foo");
16c23894 12
13package Blork;
14
15use Sub::Name;
16
17subname " Bar!", $x;
2b637511 18::is($x->(), "Blork:: Bar!");
16c23894 19
20subname "Foo::Bar::Baz", $x;
2b637511 21::is($x->(), "Foo::Bar::Baz");
16c23894 22
bbd01306 23subname "subname (dynamic $_)", \&subname for 1 .. 3;
24
25for (4 .. 5) {
26 subname "Dynamic $_", $x;
2b637511 27 ::is($x->(), "Blork::Dynamic $_");
bbd01306 28}
16c23894 29
2b637511 30::is($DB::sub{"main::foo"}, $anon);
3967e628 31
32for (4 .. 5) {
2b637511 33 ::is($DB::sub{"Blork::Dynamic $_"}, $anon);
3967e628 34}
35
3967e628 36for ("Blork:: Bar!", "Foo::Bar::Baz") {
2b637511 37 ::is($DB::sub{$_}, $anon);
3967e628 38}
39
2b637511 40::done_testing;
16c23894 41# vim: ft=perl