X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_utils_load_class.t;h=8fe1828f7933863b90c8e768c15b7826c07d56c3;hb=f04fdedae056296d0fa97fbdcaa85b9811ca6a5b;hp=cddc400bb75fe7806fa0b18be05e423ab243ee78;hpb=d9183506af8ce9cd1339fceb19d941f293efb17b;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_utils_load_class.t b/t/unit_utils_load_class.t index cddc400..8fe1828 100644 --- a/t/unit_utils_load_class.t +++ b/t/unit_utils_load_class.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 12; +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' ); @@ -49,3 +54,11 @@ undef $@; eval { Catalyst::Utils::ensure_class_loaded("This::Module::Is::Not::In::Inc::But::Does::Exist") }; ok( !$@, "no error when loading non existent .pm that *does* have a symbol table entry" ); +undef $@; +eval { Catalyst::Utils::ensure_class_loaded('Silly::File::.#Name') }; +like($@, qr/Malformed class Name/, 'errored when attempting to load a file beginning with a .'); + +undef $@; +eval { Catalyst::Utils::ensure_class_loaded('Silly::File::Name.pm') }; +like($@, qr/Malformed class Name/, 'errored sanely when given a classname ending in .pm'); +