remove direct use of Class::C3 in tests
[p5sagit/Class-C3-Componentised.git] / t / 01-basic.t
index f655db8..8bc81fd 100644 (file)
@@ -8,7 +8,7 @@ use Class::Inspector;
 
 use lib "$FindBin::Bin/lib";
 
-plan tests => 22;
+plan tests => 23;
 
 BEGIN {
   package TestPackage::A;
@@ -48,9 +48,14 @@ ok( !$retval, 'nonexistent package not loaded' );
 $retval = eval { MyModule->load_optional_class('MyModule::OwnComponent') };
 ok( !$@, 'load_optional_class on an existing class did not throw' );
 ok( $retval, 'MyModule::OwnComponent loaded' );
-eval { MyModule->load_optional_class('MyModule::ErrorComponent') };
-like( $@, qr/did not return a true value/,
-      'MyModule::ErrorComponent threw ok' );
+throws_ok (
+  sub { MyModule->load_optional_class('MyModule::ErrorComponent') },
+  qr/did not return a true value/,
+  'MyModule::ErrorComponent threw ok'
+);
+
+eval { MyModule->load_optional_class('ENDS::WITH::COLONS::') };
+like( $@, qr/Invalid class name 'ENDS::WITH::COLONS::'/, 'Throw on Class::' );
 
 # Simulate a PAR environment
 { 
@@ -91,7 +96,7 @@ like( $@, qr/did not return a true value/,
   ok( $retval, 'PAR package "loaded"' );
   
   # see if we can still load stuff with the coderef present
-  $retval = eval { MyModule->load_optional_class('Class::C3') };
+  $retval = eval { MyModule->load_optional_class('AnotherModule') };
   ok( !$@, 'load_optional_class did not throw' ) || diag $@;
-  ok( $retval, 'Class::C3 loaded' );
+  ok( $retval, 'AnotherModule loaded' );
 }