Switched to Module::Install
[catagits/Catalyst-Runtime.git] / t / unit_core_component.t
CommitLineData
fbcc39ad 1use Test::More tests => 7;
2use strict;
3use warnings;
4
5use_ok('Catalyst');
6
7my @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
17is(MyApp->comp('MyApp::V::View'), 'MyApp::V::View', 'Explicit return ok');
18
19is(MyApp->comp('C::Controller'), 'MyApp::C::Controller', 'Two-part return ok');
20
21is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok');
22
23is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
24
25is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok');
26
27is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok');
28 # Is this desired behaviour?