From: Shawn M Moore Date: Sun, 8 Mar 2009 07:51:30 +0000 (-0400) Subject: Add failing test (on 5.8.8 anyway) for rebless + overload X-Git-Tag: 0.78_01~87 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ff22cc5e082045f41f50e5de52101552a1c41b2;p=gitmo%2FClass-MOP.git Add failing test (on 5.8.8 anyway) for rebless + overload --- diff --git a/t/306_rebless_overload.t b/t/306_rebless_overload.t new file mode 100644 index 0000000..c431954 --- /dev/null +++ b/t/306_rebless_overload.t @@ -0,0 +1,26 @@ +use strict; +use warnings; +use Test::More tests => 3; +use Class::MOP; + +do { + package Without::Overloading; + sub new { bless {}, shift } + + package With::Overloading; + use base 'Without::Overloading'; + use overload q{""} => sub { "overloaded" }; +}; + +my $without = bless {}, "Without::Overloading"; +like("$without", qr/^Without::Overloading/, "no overloading"); + +my $with = With::Overloading->new; +is("$with", "overloaded", "initial overloading works"); + + +my $meta = Class::MOP::Class->initialize('With::Overloading'); + +$meta->rebless_instance($without); +is("$without", "overloaded", "overloading after reblessing works"); +