Commit | Line | Data |
b2b106d7 |
1 | #!/usr/bin/perl |
c47cf415 |
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; |
b2b106d7 |
5 | use strict; |
6 | use warnings; |
7 | |
c47cf415 |
8 | use Test::More; |
9 | $TODO = q{Mouse is not yet completed}; |
b2b106d7 |
10 | use Test::Exception; |
11 | |
12 | my @phonograph; |
13 | { |
14 | package Duck; |
15 | use Mouse; |
16 | |
17 | sub walk { |
18 | push @phonograph, 'footsteps', |
19 | } |
20 | |
21 | sub quack { |
22 | push @phonograph, 'quack'; |
23 | } |
24 | |
25 | package Swan; |
26 | use Mouse; |
27 | |
28 | sub honk { |
29 | push @phonograph, 'honk'; |
30 | } |
31 | |
32 | package DucktypeTest; |
33 | use Mouse; |
34 | use Mouse::Util::TypeConstraints; |
35 | |
36 | my $ducktype = duck_type 'DuckType' => qw(walk quack); |
37 | |
38 | has duck => ( |
39 | isa => $ducktype, |
40 | handles => $ducktype, |
41 | ); |
42 | } |
43 | |
44 | my $t = DucktypeTest->new(duck => Duck->new); |
45 | $t->quack; |
46 | is_deeply([splice @phonograph], ['quack']); |
47 | |
48 | $t->walk; |
49 | is_deeply([splice @phonograph], ['footsteps']); |
50 | |
c47cf415 |
51 | done_testing; |