Include method name in immutable methods (fixes #49680)
[gitmo/Class-MOP.git] / t / 306_rebless_overload.t
CommitLineData
4ff22cc5 1use strict;
2use warnings;
3use Test::More tests => 3;
4use Class::MOP;
5
6do {
7 package Without::Overloading;
8 sub new { bless {}, shift }
9
10 package With::Overloading;
11 use base 'Without::Overloading';
12 use overload q{""} => sub { "overloaded" };
13};
14
15my $without = bless {}, "Without::Overloading";
16like("$without", qr/^Without::Overloading/, "no overloading");
17
18my $with = With::Overloading->new;
19is("$with", "overloaded", "initial overloading works");
20
21
22my $meta = Class::MOP::Class->initialize('With::Overloading');
23
24$meta->rebless_instance($without);
25is("$without", "overloaded", "overloading after reblessing works");
26