diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-01-03 19:58:44 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-01-03 19:58:44 -0600 |
commit | 27c82de8c5a52ccf67c053a5c8e617c999bbb6e7 (patch) | |
tree | b0da15c28d14e3582624e34433613bb93b50ee1c /t | |
parent | 23bce74bb13d59926df49ef497be9ed46dc4ebcb (diff) | |
download | package-stash-27c82de8c5a52ccf67c053a5c8e617c999bbb6e7.tar.gz package-stash-27c82de8c5a52ccf67c053a5c8e617c999bbb6e7.zip |
sync tests
Diffstat (limited to 't')
-rw-r--r-- | t/magic.t | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/magic.t b/t/magic.t new file mode 100644 index 0000000..4318f58 --- /dev/null +++ b/t/magic.t @@ -0,0 +1,32 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use lib 't/lib'; +use Test::More; + +use Package::Stash; + +# @ISA magic +{ + my $Foo = Package::Stash->new('ISAFoo'); + $Foo->add_symbol('&foo' => sub { }); + + my $Bar = Package::Stash->new('ISABar'); + @{ $Bar->get_or_add_symbol('@ISA') } = ('ISAFoo'); + can_ok('ISABar', 'foo'); + + my $Foo2 = Package::Stash->new('ISAFoo2'); + $Foo2->add_symbol('&foo2' => sub { }); + @{ $Bar->get_or_add_symbol('@ISA') } = ('ISAFoo2'); + can_ok('ISABar', 'foo2'); + ok(!Bar->can('foo')); +} + +{ + my $main = Package::Stash->new('main'); + $main->add_symbol('$"', '-'); + my @foo = qw(a b c); + is(eval q["@foo"], 'a-b-c'); +} + +done_testing; |