Commit | Line | Data |
67199842 |
1 | #!/usr/bin/perl |
fde8e43f |
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; |
67199842 |
5 | |
6 | use strict; |
7 | use warnings; |
8 | |
fde8e43f |
9 | use Test::More; |
67199842 |
10 | use Test::Mouse; |
11 | |
12 | { |
13 | package My::Role; |
14 | use Mouse::Role; |
6cfa1e5e |
15 | |
67199842 |
16 | sub foo { "FOO" } |
6cfa1e5e |
17 | sub bar { "BAR" } |
67199842 |
18 | } |
19 | |
20 | { |
21 | package My::Class; |
22 | use Mouse; |
6cfa1e5e |
23 | |
67199842 |
24 | with 'My::Role' => { |
6cfa1e5e |
25 | -alias => { foo => 'baz', bar => 'gorch' }, |
26 | -excludes => ['foo', 'bar'], |
67199842 |
27 | }; |
28 | } |
29 | |
30 | { |
31 | my $x = My::Class->new; |
32 | isa_ok($x, 'My::Class'); |
33 | does_ok($x, 'My::Role'); |
34 | |
35 | can_ok($x, $_) for qw[baz gorch]; |
36 | |
37 | ok(!$x->can($_), '... cant call method ' . $_) for qw[foo bar]; |
38 | |
39 | is($x->baz, 'FOO', '... got the right value'); |
40 | is($x->gorch, 'BAR', '... got the right value'); |
41 | } |
42 | |
43 | { |
44 | package My::Role::Again; |
45 | use Mouse::Role; |
6cfa1e5e |
46 | |
67199842 |
47 | with 'My::Role' => { |
6cfa1e5e |
48 | -alias => { foo => 'baz', bar => 'gorch' }, |
49 | -excludes => ['foo', 'bar'], |
67199842 |
50 | }; |
6cfa1e5e |
51 | |
67199842 |
52 | package My::Class::Again; |
53 | use Mouse; |
6cfa1e5e |
54 | |
67199842 |
55 | with 'My::Role::Again'; |
56 | } |
57 | |
58 | { |
59 | my $x = My::Class::Again->new; |
60 | isa_ok($x, 'My::Class::Again'); |
61 | does_ok($x, 'My::Role::Again'); |
62 | does_ok($x, 'My::Role'); |
63 | |
64 | can_ok($x, $_) for qw[baz gorch]; |
65 | |
66 | ok(!$x->can($_), '... cant call method ' . $_) for qw[foo bar]; |
67 | |
68 | is($x->baz, 'FOO', '... got the right value'); |
69 | is($x->gorch, 'BAR', '... got the right value'); |
70 | } |
71 | |
fde8e43f |
72 | done_testing; |