From 27c82de8c5a52ccf67c053a5c8e617c999bbb6e7 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 3 Jan 2013 19:58:44 -0600 Subject: sync tests --- t/magic.t | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 t/magic.t 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; -- cgit v1.2.3