make sure this is testing the right thing
[gitmo/Package-Stash.git] / t / impl-selection / basic-pp.t
index 7388e80..5c80d09 100644 (file)
@@ -255,7 +255,13 @@ is($foo_stash->get_symbol('@foo'), $ARRAY, '... got the right values for @Foo::f
 }
 
 {
-    $foo_stash->add_symbol('%zork');
+    $foo_stash->add_symbol('%bare');
+    ok(!$foo_stash->has_symbol('$bare'),
+       "add_symbol with single argument doesn't vivify scalar slot");
+}
+
+{
+    $foo_stash->add_symbol('%zork', {});
 
     my $syms = $foo_stash->get_all_symbols('HASH');
 
@@ -269,10 +275,9 @@ is($foo_stash->get_symbol('@foo'), $ARRAY, '... got the right values for @Foo::f
         is($syms->{$symbol}, $foo_stash->get_symbol('%' . $symbol), '... got the right symbol');
     }
 
-    no warnings 'once';
     is_deeply(
         $syms,
-        { zork => \%Foo::zork },
+        { zork => *{ $Foo::{zork} }{HASH} },
         "got the right ones",
     );
 }
@@ -395,8 +400,8 @@ like(exception {
         [qw(BEGIN bar baz foo quuuux quuux quux)],
         "list_all_symbols",
     );
-    { local $TODO = ($] < 5.010 || $Package::Stash::IMPLEMENTATION eq 'PP')
-          ? "undef scalars aren't visible on 5.8, or from pure perl at all"
+    { local $TODO = $] < 5.010
+          ? "undef scalars aren't visible on 5.8"
           : undef;
     is_deeply(
         [sort $quuux->list_all_symbols('SCALAR')],
@@ -421,4 +426,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;