summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E Keenan <jkeenan@cpan.org>2013-07-04 15:33:40 +0200
committerTony Cook <tony@develop-help.com>2013-07-08 19:41:50 +1000
commit66759c69ded989f8dac56fefcabe9be0898b734a (patch)
tree3b11fb3fddfb54217adeab71a7016b73cb08a2fd
parent4105b9fdf17a72f17cc0d8dca8b8fca3d05612f8 (diff)
downloadperl-66759c69ded989f8dac56fefcabe9be0898b734a.tar.gz
Add tests for two previously unexercised sections of lib/Symbol.pm.
-rw-r--r--lib/Symbol.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Symbol.t b/lib/Symbol.t
index c8a7c0773f..8a0cc7a934 100644
--- a/lib/Symbol.t
+++ b/lib/Symbol.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-use Test::More tests => 19;
+use Test::More tests => 26;
BEGIN { $_ = 'foo'; } # because Symbol used to clobber $_
@@ -75,3 +75,16 @@ Symbol::delete_package('Transient');
ok( !exists $Transient::{variable}, 'transient variable no longer in stash' );
is( scalar(keys %Transient::), 0, 'transient stash is empty' );
ok( !exists $::{'Transient::'}, 'no transient stash' );
+
+$Foo::variable = 43;
+ok( exists $::{'Foo::'}, 'second transient stash exists' );
+ok( defined $Foo::{variable}, 'second transient variable in stash' );
+Symbol::delete_package('::Foo');
+is( scalar(keys %Foo::), 0, 'second transient stash is empty' );
+ok( !exists $::{'Foo::'}, 'no second transient stash' );
+
+$Bar::variable = 44;
+ok( exists $::{'Bar::'}, 'third transient stash exists' );
+ok( defined $Bar::{variable}, 'third transient variable in stash' );
+ok( ! defined(Symbol::delete_package('Bar::Bar::')),
+ 'delete_package() returns undef due to undefined leaf');