clean up debugger environment before testing with it
[p5sagit/namespace-clean.git] / t / 07-debugger.t
CommitLineData
80e4e267 1use Test::More;
2
3BEGIN {
df4cbc4e 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 }
39bc2d6e 12 else {
13 plan tests => 4;
14 }
7f55a1ec 15}
16
7f55a1ec 17BEGIN {
ac5c00e9 18 # shut up the debugger
6fc5ae48 19 delete $ENV{$_} for grep /^PERL5?DB/, keys %ENV;
20 delete $ENV{LOGDIR};
21 $ENV{HOME} = '.';
22 $ENV{PERLDB_OPTS} = 'NonStop noTTY';
80e4e267 23}
24
25BEGIN {
26
27#line 1
28#!/usr/bin/perl -d
6fc5ae48 29#line 30
80e4e267 30
31}
32
33{
34 package Foo;
35
36 BEGIN { *baz = sub { 42 } }
37 sub foo { 22 }
38
39 use namespace::clean;
40
41 sub bar {
42 ::is(baz(), 42);
43 ::is(foo(), 22);
44 }
45}
46
47ok( !Foo->can("foo"), "foo cleaned up" );
48ok( !Foo->can("baz"), "baz cleaned up" );
49
50Foo->bar();