Add failing test (on 5.8.8 anyway) for rebless + overload
Shawn M Moore [Sun, 8 Mar 2009 07:51:30 +0000 (03:51 -0400)]
t/306_rebless_overload.t [new file with mode: 0644]

diff --git a/t/306_rebless_overload.t b/t/306_rebless_overload.t
new file mode 100644 (file)
index 0000000..c431954
--- /dev/null
@@ -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");
+