X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F54taint.t;h=c3df11fd2115be4ee2ad072b5b5f3c921743f32a;hb=4225194590a09e29451ba825c34483f98c1a0c03;hp=69f69efa4d259cd884ee1d8e9b642cc9073ae58e;hpb=3fe04f740f70bc788e454cbe31775e30dce40397;p=dbsrgits%2FDBIx-Class.git diff --git a/t/54taint.t b/t/54taint.t index 69f69ef..c3df11f 100644 --- a/t/54taint.t +++ b/t/54taint.t @@ -5,29 +5,41 @@ use strict; use warnings; -our @plan; +use Test::More; +BEGIN { plan tests => 7 } -BEGIN { - eval "require Module::Find;"; - @plan = $@ ? ( skip_all => 'Could not load Module::Find' ) - : ( tests => 2 ); -} +package DBICTest::Taint::Classes; -package DBICTest::Plain; - -# Use the Plain test class namespace to avoid the need for a -# new test infrastructure. If invalid classes will be introduced to -# 't/lib/DBICTest/Plain/' someday, this has to be reworked. +use Test::More; +use Test::Exception; use lib qw(t/lib); +use base qw/DBIx::Class::Schema/; + +lives_ok (sub { + __PACKAGE__->load_classes(qw/Manual/); + ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' ); + __PACKAGE__->_unregister_source (qw/Manual/); +}, 'Loading classes with explicit load_classes worked in taint mode' ); + +lives_ok (sub { + __PACKAGE__->load_classes(); + ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' ); + ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' ); +}, 'Loading classes with Module::Find/load_classes worked in taint mode' ); -use Test::More @plan; +package DBICTest::Taint::Namespaces; + +use Test::More; +use Test::Exception; + +use lib qw(t/lib); use base qw/DBIx::Class::Schema/; -eval{ __PACKAGE__->load_classes() }; -cmp_ok( $@, 'eq', '', - 'Loading classes with Module::Find worked in taint mode' ); -ok( __PACKAGE__->source('Test'), 'The Plain::Test source has been registered' ); +lives_ok (sub { + __PACKAGE__->load_namespaces(); + ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' ); +}, 'Loading classes with Module::Find/load_namespaces worked in taint mode' ); 1;