Convert all tests to done_testing.
[gitmo/Moose.git] / t / 020_attributes / 011_more_attr_delegation.t
index 05393ad..18b8fc1 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 43;
+use Test::More;
 use Test::Exception;
 
 =pod
@@ -91,7 +91,8 @@ do not fail at compile time.
     package Parent;
     use Moose;
 
-    sub parent_method_1 { "parrent_1" }
+    sub parent_method_1 { "parent_1" }
+    ::can_ok('Parent', 'parent_method_1');
 
     ::dies_ok {
         has child_a => (
@@ -181,6 +182,7 @@ do not fail at compile time.
         );
     } "can delegate to object even without explicit reader";
 
+    ::can_ok('Parent', 'parent_method_1');
     ::dies_ok {
         has child_h => (
             isa     => "ChildH",
@@ -189,13 +191,17 @@ do not fail at compile time.
             handles => sub { map { $_, $_ } $_[1]->get_all_method_names },
         );
     } "Can't override exisiting class method in delegate";
+    ::can_ok('Parent', 'parent_method_1');
 
     ::lives_ok {
         has child_i => (
             isa     => "ChildI",
             is      => "ro",
             default => sub { ChildI->new },
-            handles => sub { map { $_, $_ } grep { !/^parent_method_1$/ }$_[1]->get_all_method_names },
+            handles => sub {
+                map { $_, $_ } grep { !/^parent_method_1|meta$/ }
+                    $_[1]->get_all_method_names;
+            },
         );
     } "Test handles code ref for skipping predefined methods";
 
@@ -250,3 +256,8 @@ is( $p->child_e_method_2, "e2", "delegate to non moose class (child_e_method_2)"
 
 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" );
+is( $p->parent_method_1, "parent_1", "delegate doesn't override existing method" );
+
+done_testing;