Properly skip debugger test when optional deps not available
[p5sagit/namespace-clean.git] / t / 07-debugger.t
1 use Test::More;
2
3 BEGIN {
4   eval { require Sub::Name }
5     or plan skip_all => "Test requires Sub::Name";
6
7   eval { require Sub::Identify }
8     or plan skip_all => "Test requires Sub::Identify";
9 }
10
11
12 BEGIN {
13   # shut up the debugger
14   $ENV{PERLDB_OPTS} = 'NonStop';
15
16   # work aroud the regex + P::S::XS buggery on
17   # < 5.8.6
18   require Package::Stash;
19 }
20
21 BEGIN {
22
23 #line 1
24 #!/usr/bin/perl -d
25 #line 10
26
27 }
28
29 {
30     package Foo;
31
32     BEGIN { *baz = sub { 42 } }
33     sub foo { 22 }
34
35     use namespace::clean;
36
37     sub bar {
38         ::is(baz(), 42);
39         ::is(foo(), 22);
40     }
41 }
42
43 ok( !Foo->can("foo"), "foo cleaned up" );
44 ok( !Foo->can("baz"), "baz cleaned up" );
45
46 Foo->bar();
47
48 done_testing;