Restrict debugger workaround to when DB::sub will be used
[p5sagit/namespace-clean.git] / t / 07-pseudo-debugger.t
diff --git a/t/07-pseudo-debugger.t b/t/07-pseudo-debugger.t
new file mode 100644 (file)
index 0000000..f7020d9
--- /dev/null
@@ -0,0 +1,32 @@
+use warnings;
+use strict;
+
+use Test::More tests => 4;
+use lib 't/lib';
+
+BEGIN {
+
+#line 1
+#!/usr/bin/perl -d:_NC_TEST_DashD
+#line 12
+
+}
+
+{
+    package Foo;
+
+    BEGIN { *baz = sub { 42 } }
+    sub foo { 22 }
+
+    use namespace::clean;
+
+    sub bar {
+        ::is(baz(), 42);
+        ::is(foo(), 22);
+    }
+}
+
+ok( !Foo->can("foo"), "foo cleaned up" );
+ok( !Foo->can("baz"), "baz cleaned up" );
+
+Foo->bar();