2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
9 $TODO = q{Mouse is not yet completed};
43 use Mouse::Util::TypeConstraints;
45 duck_type 'DuckType' => qw(quack);
46 duck_type 'SwanType' => [qw(honk)];
54 sub _build_duck { Duck->new }
57 isa => duck_type( [qw(honk)] ),
68 # try giving it a duck
69 lives_ok { DucktypeTest->new( duck => Duck->new ) } 'the Duck lives okay';
71 # try giving it a swan which is like a duck, but not close enough
72 throws_ok { DucktypeTest->new( duck => Swan->new ) }
73 qr/Swan is missing methods 'quack'/,
74 "the Swan doesn't quack";
76 # try giving it a rubber RubberDuckey
77 lives_ok { DucktypeTest->new( swan => Swan->new ) } 'but a Swan can honk';
79 # try giving it a rubber RubberDuckey
80 lives_ok { DucktypeTest->new( duck => RubberDuck->new ) }
81 'the RubberDuck lives okay';
83 # try with the other constraint form
84 lives_ok { DucktypeTest->new( other_swan => Swan->new ) } 'but a Swan can honk';