This can't work and won't work until generated components do a role. I need that...
[catagits/CatalystX-DynamicComponent.git] / t / 00load_and_sane.t
1 use strict;
2 use warnings;
3
4 # FIXME - This is all fairly gross and hacky. Surely there should be a nicer
5 #         more generic approach.
6
7 use FindBin qw/$Bin/;
8 use lib ("$Bin/lib", "$Bin/../lib");
9
10 use List::MoreUtils qw/any all/;
11 use Module::Find;
12 setmoduledirs("$Bin/../lib", "$Bin/lib");
13
14 use Test::More tests => 5;
15 use Test::Exception;
16
17 my @modules;
18 lives_ok {
19     @modules = (useall('CatalystX'), useall('DynamicAppDemo'));
20 } 'Use all';
21 ok @modules;
22
23 ok ! any( sub { ! $_->isa('Moose::Object') },
24           grep { $_->meta !~ /::Role/   }
25           grep { ! $_->can('import')    }
26           @modules
27     ),
28     'Moose in da hoose';
29
30 ok ! any(sub { $_->can('has') && warn("$_ can has") && 1; }, @modules),
31     'However, no lolcat to be found';
32
33 ok 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