#!/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
# -------------------------------------------------------------------
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');
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'),
+ );
}
{
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
# -------------------------------------------------------------------
my $k = Bar->new(foo => "Foo");
lives_ok { $k->foo_baz } "but not for class name";
}
+
+done_testing;