From: Jesse Luehrs Date: Tue, 6 Sep 2011 01:03:04 +0000 (-0500) Subject: sync tests X-Git-Tag: 0.24~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0d52465c46f70ad17b14a90db6e5e5eb557b591;p=gitmo%2FPackage-Stash-XS.git sync tests --- diff --git a/t/basic.t b/t/basic.t index a106e9e..f20e055 100644 --- a/t/basic.t +++ b/t/basic.t @@ -417,4 +417,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/paamayim_nekdotayim.t b/t/paamayim_nekdotayim.t new file mode 100644 index 0000000..d17bdaf --- /dev/null +++ b/t/paamayim_nekdotayim.t @@ -0,0 +1,28 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use lib 't/lib'; +use Test::More; +use Test::Fatal; + +use Package::Stash; + +my $stash = Package::Stash->new('Foo'); +# this segfaulted on the xs version +like( + exception { $stash->add_symbol('@bar::baz') }, + qr/^Variable names may not contain ::/, + "can't add symbol with ::" +); +like( + exception { $stash->get_symbol('@bar::baz') }, + qr/^Variable names may not contain ::/, + "can't add symbol with ::" +); +like( + exception { $stash->get_or_add_symbol('@bar::baz') }, + qr/^Variable names may not contain ::/, + "can't add symbol with ::" +); + +done_testing;