summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-05-11 22:44:10 -0500
committerJesse Luehrs <doy@tozt.net>2010-05-11 22:44:10 -0500
commitd2d3faf49a59ca1c3e39255af2061b001b26446e (patch)
tree02a41e6f8ac4342a1c012cb0599387f505696970 /t
parent3634ce60eff13a438a24efd8b61192aadff7d0de (diff)
downloadpackage-stash-d2d3faf49a59ca1c3e39255af2061b001b26446e.tar.gz
package-stash-d2d3faf49a59ca1c3e39255af2061b001b26446e.zip
tests for nonexistent hash/array entries
Diffstat (limited to 't')
-rw-r--r--t/004-get.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/004-get.t b/t/004-get.t
new file mode 100644
index 0000000..c38ae65
--- /dev/null
+++ b/t/004-get.t
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Stash::Manip;
+
+{
+ my $stash = Stash::Manip->new('Foo');
+ my $val = $stash->get_package_symbol('%foo');
+ is(ref($val), 'HASH', "got something");
+ $val->{bar} = 1;
+ is_deeply($stash->get_package_symbol('%foo'), {bar => 1},
+ "got the right variable");
+}
+
+{
+ my $stash = Stash::Manip->new('Bar');
+ my $val = $stash->get_package_symbol('@foo');
+ is(ref($val), 'ARRAY', "got something");
+ push @$val, 1;
+ is_deeply($stash->get_package_symbol('@foo'), [1],
+ "got the right variable");
+}
+
+done_testing;