summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-11-29 02:55:11 -0600
committerJesse Luehrs <doy@tozt.net>2011-11-29 03:05:50 -0600
commitabe3605b9e63d97458ea495347501b5696ec2bc8 (patch)
treecdb60b33910aa775d6ca294ad91d94eb77bba9ef
parent0f40e41f356af017fc3ff3a2c685c61ff648b4c0 (diff)
downloadpackage-stash-abe3605b9e63d97458ea495347501b5696ec2bc8.tar.gz
package-stash-abe3605b9e63d97458ea495347501b5696ec2bc8.zip
sync impl-selection tests
-rw-r--r--t/impl-selection/basic-pp.t22
-rw-r--r--t/impl-selection/basic-xs.t22
2 files changed, 44 insertions, 0 deletions
diff --git a/t/impl-selection/basic-pp.t b/t/impl-selection/basic-pp.t
index 398f383..086368e 100644
--- a/t/impl-selection/basic-pp.t
+++ b/t/impl-selection/basic-pp.t
@@ -256,6 +256,8 @@ is($foo_stash->get_symbol('@foo'), $ARRAY, '... got the right values for @Foo::f
{
$foo_stash->add_symbol('%zork');
+ ok(!$foo_stash->has_symbol('$zork'),
+ "add_symbol with single argument doesn't vivify scalar slot");
my $syms = $foo_stash->get_all_symbols('HASH');
@@ -421,4 +423,24 @@ like(exception {
);
}
+for my $package ('Foo:Bar', 'Foo/Bar', 'Foo Bar', 'Foo:::Bar', '') {
+ like(
+ exception { Package::Stash->new($package) },
+ qr/^$package is not a module name/,
+ "$package is not a module name"
+ );
+}
+
+like(
+ exception { Package::Stash->new([]) },
+ qr/^Package::Stash->new must be passed the name of the package to access/,
+ "module name must be a string"
+);
+
+like(
+ exception { Package::Stash->new(undef) },
+ qr/^Package::Stash->new must be passed the name of the package to access/,
+ "module name must be a string"
+);
+
done_testing;
diff --git a/t/impl-selection/basic-xs.t b/t/impl-selection/basic-xs.t
index 0fe2aa3..8a1b40b 100644
--- a/t/impl-selection/basic-xs.t
+++ b/t/impl-selection/basic-xs.t
@@ -257,6 +257,8 @@ is($foo_stash->get_symbol('@foo'), $ARRAY, '... got the right values for @Foo::f
{
$foo_stash->add_symbol('%zork');
+ ok(!$foo_stash->has_symbol('$zork'),
+ "add_symbol with single argument doesn't vivify scalar slot");
my $syms = $foo_stash->get_all_symbols('HASH');
@@ -422,4 +424,24 @@ like(exception {
);
}
+for my $package ('Foo:Bar', 'Foo/Bar', 'Foo Bar', 'Foo:::Bar', '') {
+ like(
+ exception { Package::Stash->new($package) },
+ qr/^$package is not a module name/,
+ "$package is not a module name"
+ );
+}
+
+like(
+ exception { Package::Stash->new([]) },
+ qr/^Package::Stash->new must be passed the name of the package to access/,
+ "module name must be a string"
+);
+
+like(
+ exception { Package::Stash->new(undef) },
+ qr/^Package::Stash->new must be passed the name of the package to access/,
+ "module name must be a string"
+);
+
done_testing;