summaryrefslogtreecommitdiffstats
path: root/t/001-basic.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-05-11 22:11:15 -0500
committerJesse Luehrs <doy@tozt.net>2010-05-11 22:28:21 -0500
commit3634ce60eff13a438a24efd8b61192aadff7d0de (patch)
tree69834701b2dc9938cd92483e8f1790289630b8c5 /t/001-basic.t
parent56a29840c0b7b0c4a09243ea05400c3df8ad0823 (diff)
downloadpackage-stash-3634ce60eff13a438a24efd8b61192aadff7d0de.tar.gz
package-stash-3634ce60eff13a438a24efd8b61192aadff7d0de.zip
error when trying to init a stash slot with a value of the wrong type
Diffstat (limited to 't/001-basic.t')
-rw-r--r--t/001-basic.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/001-basic.t b/t/001-basic.t
index 52ddfaa..ef95bf1 100644
--- a/t/001-basic.t
+++ b/t/001-basic.t
@@ -225,4 +225,27 @@ is($foo_stash->get_package_symbol('@foo'), $ARRAY, '... got the right values for
ok(defined(*{"Foo::foo"}{ARRAY}), '... the @foo slot has NOT been removed');
}
+# check some errors
+
+dies_ok {
+ $foo_stash->add_package_symbol('@bar', {})
+} "can't initialize a slot with the wrong type of value";
+
+dies_ok {
+ $foo_stash->add_package_symbol('bar', [])
+} "can't initialize a slot with the wrong type of value";
+
+dies_ok {
+ $foo_stash->add_package_symbol('$bar', sub { })
+} "can't initialize a slot with the wrong type of value";
+
+{
+ package Bar;
+ open *foo, '<', $0;
+}
+
+dies_ok {
+ $foo_stash->add_package_symbol('$bar', *Bar::foo{IO})
+} "can't initialize a slot with the wrong type of value";
+
done_testing;