test updates
[gitmo/Package-Stash.git] / t / 07-edge-cases.t
index 4f61ca2..6bed48e 100755 (executable)
@@ -63,7 +63,28 @@ is(exception { $Bar->add_symbol('$foo', \$foo) }, undef,
    "can add PVIV values");
 is(exception { $Bar->add_symbol('$bar', \$bar) }, undef,
    "can add PVNV values");
+is(exception { bless \$bar, 'Foo'; $Bar->add_symbol('$bar2', $bar) }, undef,
+   "can add PVMG values");
+is(exception { $Bar->add_symbol('$baz', qr/foo/) }, undef,
+   "can add regex values");
+is(exception { undef $bar; $Bar->add_symbol('$quux', \$bar) }, undef,
+   "can add undef values that aren't NULL");
 
 use_ok('CompileTime');
 
+{
+    package Gets::Deleted;
+    sub bar { }
+}
+
+{
+    my $delete = Package::Stash->new('Gets::Deleted');
+    ok($delete->has_symbol('&bar'), "sees the method");
+    {
+        no strict 'refs';
+        delete ${'main::Gets::'}{'Deleted::'};
+    }
+    ok(!$delete->has_symbol('&bar'), "method goes away when stash is deleted");
+}
+
 done_testing;