diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-01-05 23:10:53 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-01-05 23:15:38 -0600 |
commit | 6c30b2737f4adccfeb54a9c4c34a4d9a0d98ebb5 (patch) | |
tree | 013301c4a59c286e014c21cab56d79993feca8a8 /t | |
parent | 0b8010de36cb8e856024e526756389d7d10b483a (diff) | |
download | package-stash-6c30b2737f4adccfeb54a9c4c34a4d9a0d98ebb5.tar.gz package-stash-6c30b2737f4adccfeb54a9c4c34a4d9a0d98ebb5.zip |
update test suite
Diffstat (limited to 't')
-rwxr-xr-x | t/07-edge-cases.t | 14 | ||||
-rw-r--r-- | t/lib/CompileTime.pm | 15 |
2 files changed, 29 insertions, 0 deletions
diff --git a/t/07-edge-cases.t b/t/07-edge-cases.t index cf75847..4f61ca2 100755 --- a/t/07-edge-cases.t +++ b/t/07-edge-cases.t @@ -3,6 +3,7 @@ use strict; use warnings; use lib 't/lib'; use Test::More; +use Test::Fatal; use Package::Stash; @@ -52,4 +53,17 @@ is(ref($constant), 'CODE', "expanded a constant into a coderef"); is(ref($stash->get_symbol('$glob')), '', "nothing yet"); is(ref($stash->get_or_add_symbol('$glob')), 'SCALAR', "got an empty scalar"); +my $Bar = Package::Stash->new('Bar'); +my $foo = 3; +$foo =~ s/3/4/; +my $bar = 4.5; +$bar =~ s/4/5/; + +is(exception { $Bar->add_symbol('$foo', \$foo) }, undef, + "can add PVIV values"); +is(exception { $Bar->add_symbol('$bar', \$bar) }, undef, + "can add PVNV values"); + +use_ok('CompileTime'); + done_testing; diff --git a/t/lib/CompileTime.pm b/t/lib/CompileTime.pm new file mode 100644 index 0000000..925bc18 --- /dev/null +++ b/t/lib/CompileTime.pm @@ -0,0 +1,15 @@ +package CompileTime; +use strict; +use warnings; + +use Package::Stash; + +our $foo = 23; + +BEGIN { + my $stash = Package::Stash->new(__PACKAGE__); + $stash->add_symbol('$bar', $foo); + $stash->add_symbol('$baz', $stash->get_symbol('$foo')); +} + +1; |