diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-09-22 13:07:46 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-09-22 13:10:39 -0500 |
commit | 41fc247afe43b3ca9bce931d224935a7bcf5a3bf (patch) | |
tree | 79ad85e252e8854a3a9cec96ad0dc50304745d7d | |
parent | 7486ccf34361fccfb1599d244961ddbd3d8bc5a7 (diff) | |
download | package-stash-41fc247afe43b3ca9bce931d224935a7bcf5a3bf.tar.gz package-stash-41fc247afe43b3ca9bce931d224935a7bcf5a3bf.zip |
fix code vivify tests
-rw-r--r-- | t/04-get.t | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -73,6 +73,31 @@ use Package::Stash; { BEGIN { + my $stash = Package::Stash->new('Code'); + my $val = $stash->get_package_symbol('&foo'); + is($val, undef, "got nothing yet"); + } + { + no warnings 'void', 'once'; + sub Code::foo { } + } + BEGIN { + my $stash = Package::Stash->new('Code'); + my $val = $stash->get_package_symbol('&foo'); + is(ref($val), 'CODE', "got something"); + is(prototype($val), undef, "got the right variable"); + &Scalar::Util::set_prototype($val, '&'); + is($stash->get_package_symbol('&foo'), $val, + "got the right variable"); + is(prototype($stash->get_package_symbol('&foo')), '&', + "got the right variable"); + is(prototype(\&Code::foo), '&', + "stash has the right variable"); + } +} + +{ + BEGIN { my $stash = Package::Stash->new('Io'); my $val = $stash->get_package_symbol('FOO'); is($val, undef, "got nothing yet"); |