From 929e99945d25016c2ab768359ac6d69cda826013 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 18 May 2012 13:37:40 -0700 Subject: [PATCH] =?utf8?q?overload.t:=20Move=20some=20tests=20above=20?= =?utf8?q?=E2=80=98keep=20last=E2=80=99=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/overload.t | 64 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/overload.t b/lib/overload.t index a10fd4e..6efbf0f 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -2201,38 +2201,6 @@ fresh_perl_is 'Error message when sub stub is encountered'; } -sub eleventative::cos { 'eleven' } -sub twelvetative::abs { 'twelve' } -sub thirteentative::abs { 'thirteen' } -sub fourteentative::abs { 'fourteen' } -@eleventative::ISA = twelvetative::; -{ - my $o = bless [], 'eleventative'; - eval 'package eleventative; use overload map +($_)x2, cos=>abs=>'; - is cos $o, 'eleven', 'overloading applies to object blessed before'; - bless [], 'eleventative'; - is cos $o, 'eleven', - 'ovrld applies to previously-blessed obj after other obj is blessed'; - $o = bless [], 'eleventative'; - *eleventative::cos = sub { 'ten' }; - is cos $o, 'ten', 'method changes affect overloading'; - @eleventative::ISA = thirteentative::; - is abs $o, 'thirteen', 'isa changes affect overloading'; - bless $o, 'fourteentative'; - @fourteentative::ISA = 'eleventative'; - local our $TODO = '[perl #112708]'; - is abs $o, 'fourteen', 'isa changes can turn overloading on'; -} - -{ # undefining the overload stash -- KEEP THIS TEST LAST - package ant; - use overload '+' => 'onion'; - $_ = \&overload::nil; - undef %overload::; - bless[]; - ::ok(1, 'no crash when undefining %overload::'); -} - # [perl #40333] # overload::Overloaded should not use a ->can designed for autoloading. # This example attempts to be as realistic as possible. The o class has a @@ -2267,5 +2235,37 @@ ok !overload::Overloaded(new proxy new o), ok(overload::Overloaded($obj)); } +sub eleventative::cos { 'eleven' } +sub twelvetative::abs { 'twelve' } +sub thirteentative::abs { 'thirteen' } +sub fourteentative::abs { 'fourteen' } +@eleventative::ISA = twelvetative::; +{ + my $o = bless [], 'eleventative'; + eval 'package eleventative; use overload map +($_)x2, cos=>abs=>'; + is cos $o, 'eleven', 'overloading applies to object blessed before'; + bless [], 'eleventative'; + is cos $o, 'eleven', + 'ovrld applies to previously-blessed obj after other obj is blessed'; + $o = bless [], 'eleventative'; + *eleventative::cos = sub { 'ten' }; + is cos $o, 'ten', 'method changes affect overloading'; + @eleventative::ISA = thirteentative::; + is abs $o, 'thirteen', 'isa changes affect overloading'; + bless $o, 'fourteentative'; + @fourteentative::ISA = 'eleventative'; + local our $TODO = '[perl #112708]'; + is abs $o, 'fourteen', 'isa changes can turn overloading on'; +} + +{ # undefining the overload stash -- KEEP THIS TEST LAST + package ant; + use overload '+' => 'onion'; + $_ = \&overload::nil; + undef %overload::; + bless[]; + ::ok(1, 'no crash when undefining %overload::'); +} + # EOF -- 2.7.4