diff options
author | Brandon Black <blblack@gmail.com> | 2007-10-08 03:54:35 -0500 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-10-09 09:23:06 +0000 |
commit | 2e7640f0c7a7d476b21bbcc8398038c0ecc98cd6 (patch) | |
tree | b1eca8bc624aa849afafbe121e0e10ced9a936be /t/mro | |
parent | 6e8b06a81f246e3617b8995fd95f9e56936e2028 (diff) | |
download | perl-2e7640f0c7a7d476b21bbcc8398038c0ecc98cd6.tar.gz |
Re: [perl #46217] (resent) Typeglobs vs. SUPER:: (Hook::LexWrap failure)
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60710080654s589f57eax90b7f78558ad8b6f@mail.gmail.com>
new tests.
p4raw-id: //depot/perl@32074
Diffstat (limited to 't/mro')
-rw-r--r-- | t/mro/basic.t | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/t/mro/basic.t b/t/mro/basic.t index a4a61924d2..1b186617df 100644 --- a/t/mro/basic.t +++ b/t/mro/basic.t @@ -3,7 +3,7 @@ use strict; use warnings; -require q(./test.pl); plan(tests => 35); +require q(./test.pl); plan(tests => 38); { package MRO_A; @@ -190,3 +190,31 @@ is(eval { MRO_N->testfunc() }, 123); } } +# Check that SUPER caches get invalidated correctly +{ + { + package SUPERTEST; + sub new { bless {} => shift } + sub foo { $_[1]+1 } + + package SUPERTEST::MID; + our @ISA = 'SUPERTEST'; + + package SUPERTEST::KID; + our @ISA = 'SUPERTEST::MID'; + sub foo { my $s = shift; $s->SUPER::foo(@_) } + + package SUPERTEST::REBASE; + sub foo { $_[1]+3 } + } + + my $stk_obj = SUPERTEST::KID->new(); + is($stk_obj->foo(1), 2); + { no warnings 'redefine'; + *SUPERTEST::foo = sub { $_[1]+2 }; + } + is($stk_obj->foo(2), 4); + @SUPERTEST::MID::ISA = 'SUPERTEST::REBASE'; + is($stk_obj->foo(3), 6); +} + |