Cleanup failing tests
[gitmo/Mouse.git] / Moose-t-failing / 020_attributes / 010_attribute_delegation.t
@@ -1,13 +1,16 @@
 #!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
 
 use strict;
 use warnings;
 
-use Test::More tests => 92;
+use Test::More;
+$TODO = q{Mouse is not yet completed};
 use Test::Exception;
 
 
-
 # -------------------------------------------------------------------
 # HASH handles
 # -------------------------------------------------------------------
@@ -44,7 +47,7 @@ ok($bar->foo, '... we have something in bar->foo');
 isa_ok($bar->foo, 'Foo');
 
 my $meth = Bar->meta->get_method('foo_bar');
-isa_ok($meth, 'Mouse::Meta::Method::Delegation');
+isa_ok($meth, 'Mouse::Meta::Method');
 is($meth->associated_attribute->name, 'foo',
    'associated_attribute->name for this method is foo');
 
@@ -244,6 +247,15 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
         handles => 'Foo::Bar',
     );
 
+    package Foo::OtherThing;
+    use Mouse;
+    use Mouse::Util::TypeConstraints;
+
+    has 'other_thing' => (
+        is      => 'rw',
+        isa     => 'Foo::Baz',
+        handles => Mouse::Util::TypeConstraints::find_type_constraint('Foo::Bar'),
+    );
 }
 
 {
@@ -260,6 +272,19 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
     is($foo->thing->baz, 'Foo::Baz::BAZ', '... got the right value');
 }
 
+{
+    my $foo = Foo::OtherThing->new(other_thing => Foo::Baz->new);
+    isa_ok($foo, 'Foo::OtherThing');
+    isa_ok($foo->other_thing, 'Foo::Baz');
+
+    ok($foo->meta->has_method('foo'), '... we have the method we expect');
+    ok($foo->meta->has_method('bar'), '... we have the method we expect');
+    ok(!$foo->meta->has_method('baz'), '... we dont have the method we expect');
+
+    is($foo->foo, 'Foo::Baz::FOO', '... got the right value');
+    is($foo->bar, 'Foo::Baz::BAR', '... got the right value');
+    is($foo->other_thing->baz, 'Foo::Baz::BAZ', '... got the right value');
+}
 # -------------------------------------------------------------------
 # AUTOLOAD & handles
 # -------------------------------------------------------------------
@@ -434,3 +459,5 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
     my $k = Bar->new(foo => "Foo");
     lives_ok { $k->foo_baz } "but not for class name";
 }
+
+done_testing;