And get the other strategy from master implemented
[catagits/CatalystX-DynamicComponent.git] / t / 00load_and_sane.t
CommitLineData
046d763d 1use strict;
2use warnings;
3
3ed6349b 4# FIXME - This is all fairly gross and hacky. Surely there should be a nicer
5# more generic approach.
065fbd81 6
046d763d 7use FindBin qw/$Bin/;
500cd4f4 8use lib ("$Bin/lib", "$Bin/../lib");
046d763d 9
3ed6349b 10use List::MoreUtils qw/any all/;
046d763d 11use Module::Find;
104abdae 12setmoduledirs("$Bin/../lib", "$Bin/lib");
046d763d 13
3ed6349b 14use Test::More tests => 5;
046d763d 15use Test::Exception;
16
17my @modules;
18lives_ok {
3ed6349b 19 @modules = (useall('CatalystX'), useall('DynamicAppDemo'));
046d763d 20} 'Use all';
21ok @modules;
22
3ed6349b 23ok ! any( sub { ! $_->isa('Moose::Object') },
24 grep { $_->meta !~ /::Role/ }
25 grep { ! $_->can('import') }
26 @modules
27 ),
046d763d 28 'Moose in da hoose';
29
3ed6349b 30ok ! any(sub { $_->can('has') && warn("$_ can has") && 1; }, @modules),
046d763d 31 'However, no lolcat to be found';
32
3ed6349b 33ok all( sub { $_->meta->is_immutable },
34 grep { $_->meta !~ /::Role/ } # Skip roles, ewww. I would test
35 # ->isa('Moose::Role') but that fails
36 # for parameterised roles..
37 grep { ! $_->can('import') } # Skip exporters
38 @modules),
39 'And all classes are immutable';
40