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