Steal class loading code from Class::MOP, which isnt confused by __PACKAGE__
[catagits/Catalyst-Runtime.git] / t / unit_utils_load_class.t
index 06924ec..8fe1828 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 14;
+use Test::More tests => 16;
 
 use lib "t/lib";
 
@@ -41,6 +41,11 @@ eval { Catalyst::Utils::ensure_class_loaded("This::Module::Is::Probably::Not::Th
 ok( $@, "doesn't defatalize" );
 like( $@, qr/There\.pm.*\@INC/, "error looks right" );
 
+undef $@;
+eval { Catalyst::Utils::ensure_class_loaded("__PACKAGE__") };
+ok( $@, "doesn't defatalize" );
+like( $@, qr/__PACKAGE__\.pm.*\@INC/, "errors sanely on __PACKAGE__.pm" );
+
 $@ = "foo";
 Catalyst::Utils::ensure_class_loaded("TestApp::View::Dump::Response");
 is( $@, "foo", '$@ is untouched' );