X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F90ensure_class_loaded.t;h=e933c00a370a97a7b28fc875b9d22c1bd17a5a45;hb=f895c500473b77db4ecf185ed21530b821a14ed4;hp=1f28a7e6b49c3b08ece4169b02b28367ad95e338;hpb=624764ae1ce59b1019d58cae509600e38eac5ff6;p=dbsrgits%2FDBIx-Class.git diff --git a/t/90ensure_class_loaded.t b/t/90ensure_class_loaded.t index 1f28a7e..e933c00 100644 --- a/t/90ensure_class_loaded.t +++ b/t/90ensure_class_loaded.t @@ -1,9 +1,10 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); use DBICTest; +use DBIx::Class::_Util 'sigwarn_silencer'; use Class::Inspector; BEGIN { @@ -64,12 +65,9 @@ like( $@, qr/did not return a true value/, q/0;/, ); - TODO: { - local $TODO = "Current load_optional_class cannot find PAR"; - $retval = eval { $schema->load_optional_class('VIRTUAL::PAR::PACKAGE') }; - ok( $@, 'load_optional_class of a no-true-returning PAR module did throw' ); - ok( !$retval, 'no-true-returning PAR package not loaded' ); - } + $retval = eval { $schema->load_optional_class('VIRTUAL::PAR::PACKAGE') }; + ok( $@, 'load_optional_class of a no-true-returning PAR module did throw' ); + ok( !$retval, 'no-true-returning PAR package not loaded' ); # simulate a normal class (no one adjusted %INC so it will be tried again @code = ( @@ -77,12 +75,9 @@ like( $@, qr/did not return a true value/, q/1;/, ); - TODO: { - local $TODO = "Current load_optional_class cannot find PARs"; - $retval = eval { $schema->load_optional_class('VIRTUAL::PAR::PACKAGE') }; - ok( !$@, 'load_optional_class of a PAR module did not throw' ); - ok( $retval, 'PAR package "loaded"' ); - } + $retval = eval { $schema->load_optional_class('VIRTUAL::PAR::PACKAGE') }; + ok( !$@, 'load_optional_class of a PAR module did not throw' ); + ok( $retval, 'PAR package "loaded"' ); # see if we can still load stuff with the coderef present $retval = eval { $schema->load_optional_class('DBIx::Class::ResultClass::HashRefInflator') }; @@ -106,13 +101,9 @@ ok( Class::Inspector->loaded('DBICTest::FakeComponent'), { # Squash warnings about syntax errors in SytaxErrorComponent.pm - local $SIG{__WARN__} = sub { - my $warning = shift; - warn $warning unless ( - $warning =~ /String found where operator expected/ or - $warning =~ /Missing operator before/ - ); - }; + local $SIG{__WARN__} = sigwarn_silencer( + qr/String found where operator expected|Missing operator before/ + ); eval { $schema->ensure_class_loaded('DBICTest::SyntaxErrorComponent1') }; like( $@, qr/syntax error/,