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