Make the test work like I want it too. It's a gross hack currently, but now does...
Tomas Doran (t0m) [Wed, 13 May 2009 11:55:28 +0000 (12:55 +0100)]
t/00load_and_sane.t

index 70da626..2aa70eb 100644 (file)
@@ -1,27 +1,40 @@
 use strict;
 use warnings;
 
-# FIXME - Not sure if this does what I think it does, test..
+# FIXME - This is all fairly gross and hacky. Surely there should be a nicer
+#         more generic approach.
 
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 
-use List::MoreUtils qw/any/;
+use List::MoreUtils qw/any all/;
 use Module::Find;
 setmoduledirs("$Bin/../lib", "$Bin/lib");
 
-use Test::More tests => 4;
+use Test::More tests => 5;
 use Test::Exception;
 
 my @modules;
 lives_ok {
-    @modules = (useall('CtaalystX'), useall('DynamicAppDemo'));
+    @modules = (useall('CatalystX'), useall('DynamicAppDemo'));
 } 'Use all';
 ok @modules;
 
-ok ! any(sub { ! $_->isa('Moose::Object') }, @modules),
+ok ! any( sub { ! $_->isa('Moose::Object') },
+          grep { $_->meta !~ /::Role/   }
+          grep { ! $_->can('import')    }
+          @modules
+    ),
     'Moose in da hoose';
 
-ok ! any(sub { $_->can('has') }, @modules),
+ok ! any(sub { $_->can('has') && warn("$_ can has") && 1; }, @modules),
     'However, no lolcat to be found';
 
+ok all( sub  { $_->meta->is_immutable },
+        grep { $_->meta !~ /::Role/   } # Skip roles, ewww. I would test
+                                        # ->isa('Moose::Role') but that fails
+                                        # for parameterised roles..
+        grep { ! $_->can('import')    } # Skip exporters
+    @modules),
+    'And all classes are immutable';
+