9e721221ca08433b20a1bd55c302a83af3248f0a
[p5sagit/namespace-clean.git] / t / 07-debugger.t
1 use Test::More;
2
3 BEGIN {
4   require namespace::clean;
5   if (
6     namespace::clean::_Util::DEBUGGER_NEEDS_CV_RENAME()
7       and
8     my $missing_xs = namespace::clean::_Util::_namer_load_error()
9   ) {
10     plan skip_all => $missing_xs;
11   }
12 }
13
14 BEGIN {
15   # shut up the debugger
16   $ENV{PERLDB_OPTS} = 'NonStop';
17 }
18
19 BEGIN {
20
21 #line 1
22 #!/usr/bin/perl -d
23 #line 10
24
25 }
26
27 {
28     package Foo;
29
30     BEGIN { *baz = sub { 42 } }
31     sub foo { 22 }
32
33     use namespace::clean;
34
35     sub bar {
36         ::is(baz(), 42);
37         ::is(foo(), 22);
38     }
39 }
40
41 ok( !Foo->can("foo"), "foo cleaned up" );
42 ok( !Foo->can("baz"), "baz cleaned up" );
43
44 Foo->bar();
45
46 done_testing;