summaryrefslogtreecommitdiffstats
path: root/t/001-basic.t
diff options
context:
space:
mode:
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;