Properly skip debugger test when optional deps not available
[p5sagit/namespace-clean.git] / t / 07-debugger.t
CommitLineData
80e4e267 1use Test::More;
2
3BEGIN {
7f55a1ec 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
12BEGIN {
ac5c00e9 13 # shut up the debugger
80e4e267 14 $ENV{PERLDB_OPTS} = 'NonStop';
ac5c00e9 15
16 # work aroud the regex + P::S::XS buggery on
17 # < 5.8.6
18 require Package::Stash;
80e4e267 19}
20
21BEGIN {
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
43ok( !Foo->can("foo"), "foo cleaned up" );
44ok( !Foo->can("baz"), "baz cleaned up" );
45
46Foo->bar();
47
48done_testing;