use strict;
use warnings;
-use Test::More tests => 43;
+use Test::More tests => 48;
use Test::Exception;
=pod
use Moose;
sub parent_method_1 { "parent_1" }
+ ::can_ok('Parent', 'parent_method_1');
::dies_ok {
has child_a => (
);
} "can delegate to object even without explicit reader";
+ ::can_ok('Parent', 'parent_method_1');
::dies_ok {
has child_h => (
isa => "ChildH",
handles => sub { map { $_, $_ } $_[1]->get_all_method_names },
);
} "Can't override exisiting class method in delegate";
+ { our $TODO; local $TODO = 'if add_attribute dies because a delegate would have overridden a local method, the rollback code removes the original method';
+ ::can_ok('Parent', 'parent_method_1');
+ }
::lives_ok {
has child_i => (
can_ok( $p, "child_g_method_1" );
is( $p->child_g_method_1, "g1", "delegate to moose class without reader (child_g_method_1)" );
+
+can_ok( $p, "child_i_method_1" );
+{ local $TODO = 'if add_attribute dies because a delegate would have overridden a local method, the rollback code removes the original method';
+lives_and { is( $p->parent_method_1, "parent_1", "delegate doesn't override existing method" ) };
+}