From: Father Chrysostomos Date: Fri, 18 May 2012 03:44:48 +0000 (-0700) Subject: To-do tests for method/isa/overload updates and overloading X-Git-Tag: upstream/5.20.0~6821^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54f6ba105424d583f3ad66ad05790975c5d7a86d;p=platform%2Fupstream%2Fperl.git To-do tests for method/isa/overload updates and overloading Changes to methods, @ISA, or overload settings should affect objects that are already blessed into the class. Currently, objects that existed before any overload settings were in place do not do overloading at all (bug #112708). Objects that were blessed when overload settings were in place are not affected by changes to methods or @ISA until another object is blessed into the same class. --- diff --git a/lib/overload.t b/lib/overload.t index c0478ee..54eb75c 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -48,7 +48,7 @@ package main; $| = 1; BEGIN { require './test.pl' } -plan tests => 5041; +plan tests => 5045; use Scalar::Util qw(tainted); @@ -2200,6 +2200,25 @@ fresh_perl_is 'Error message when sub stub is encountered'; } +sub eleventative::cos { 'eleven' } +sub twelvetative::abs { 'twelve' } +sub thirteentative::abs { 'thirteen' } +@eleventative::ISA = twelvetative::; +{ + local our $TODO = '[perl #112708]'; + 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'; +} + { # undefining the overload stash -- KEEP THIS TEST LAST package ant; use overload '+' => 'onion';