Commit | Line | Data |
fbcc39ad |
1 | use Test::More tests => 7; |
2 | use strict; |
3 | use warnings; |
4 | |
5 | use_ok('Catalyst'); |
6 | |
7 | my @complist = map { "MyApp::$_"; } qw/C::Controller M::Model V::View/; |
8 | |
9 | { |
10 | package MyApp; |
11 | |
12 | use base qw/Catalyst/; |
13 | |
14 | __PACKAGE__->components({ map { ($_, $_) } @complist }); |
15 | } |
16 | |
17 | is(MyApp->comp('MyApp::V::View'), 'MyApp::V::View', 'Explicit return ok'); |
18 | |
19 | is(MyApp->comp('C::Controller'), 'MyApp::C::Controller', 'Two-part return ok'); |
20 | |
21 | is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok'); |
22 | |
23 | is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok'); |
24 | |
25 | is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok'); |
26 | |
27 | is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok'); |
28 | # Is this desired behaviour? |