Revision history for Class-C3-Componentised
+1.0002 4 Mar 2008
+ Make tests more resilient
+
1.0001 11 Aug 2007
Add missing dep on Test::Exception
Class::Inspector->installed($f_class);
}
-# Returns a true value if the specified class is installed and loaded
-# successfully, throws an exception if the class is found but not loaded
-# successfully, and false if the class is not installed
-sub _load_optional_class {
- my ($class, $f_class) = @_;
- if ($class->ensure_class_found($f_class)) {
- $class->ensure_class_loaded($f_class);
- return 1;
- } else {
- return 0;
- }
-}
=head2 inject_base
use warnings;
use FindBin;
-use lib "$FindBin::Bin/lib";
-
use Test::More;
use Test::Exception;
+use lib "$FindBin::Bin/lib";
+
+
plan tests => 3;
use_ok('MyModule');
MyModule->load_components('Foo');
-throws_ok { MyModule->load_components('+Foo'); } qr/^Can't locate Foo.pm in \@INC/;
+# Clear down inc so ppl dont mess us up with installing modules that we
+# expect not to exist
+@INC = ();
+
+throws_ok { MyModule->load_components('+ClassC3ComponentFooThatShouldntExist'); } qr/^Can't locate ClassC3ComponentFooThatShouldntExist.pm in \@INC/;
is(MyModule->new->message, "Foo MyModule", "it worked");