From: Jason M. Mills Date: Thu, 20 Nov 2008 15:29:29 +0000 (+0000) Subject: Added weird passes/failes test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=45f8858e63e1c76e4ab939685615d9da8944a055;p=dbsrgits%2FDBIx-Class-Historic.git Added weird passes/failes test --- diff --git a/t/39load_namespaces_rt41083.t b/t/39load_namespaces_rt41083.t index facb70f..88fd6b7 100644 --- a/t/39load_namespaces_rt41083.t +++ b/t/39load_namespaces_rt41083.t @@ -8,20 +8,35 @@ use lib 't/lib'; plan tests => 2; +sub _chk_warning { + defined $_[0]? + $_[0] !~ qr/We found ResultSet class '([^']+)' for '([^']+)', but it seems that you had already set '([^']+)' to use '([^']+)' instead/ : + 1 +} + my $warnings; eval { local $SIG{__WARN__} = sub { $warnings .= shift }; package DBICNSTest::RtBug41083; use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces( + result_namespace => 'Schema_A', + resultset_namespace => 'ResultSet_A', + default_resultset_class => 'ResultSet' + ); +}; +ok(!$@) or diag $@; +ok(_chk_warning($warnings), 'Works here'); + +eval { + local $SIG{__WARN__} = sub { $warnings .= shift }; + package DBICNSTest::RtBug41083; + use base 'DBIx::Class::Schema'; + __PACKAGE__->load_namespaces( result_namespace => 'Schema', resultset_namespace => 'ResultSet', default_resultset_class => 'ResultSet' ); }; ok(!$@) or diag $@; -ok( - $warnings !~ - qr/We found ResultSet class '([^']+)' for '([^']+)', but it seems that you had already set '([^']+)' to use '([^']+)' instead/, - 'Proxy sub class did not generate an error' -); +ok(_chk_warning($warnings), 'Fails here'); diff --git a/t/lib/DBICNSTest/RtBug41083/ResultSet/A.pm b/t/lib/DBICNSTest/RtBug41083/ResultSet/A.pm new file mode 100644 index 0000000..d8bfa35 --- /dev/null +++ b/t/lib/DBICNSTest/RtBug41083/ResultSet/A.pm @@ -0,0 +1,5 @@ +package DBICNSTest::RtBug41083::ResultSet::A; +use strict; +use warnings; +use base 'DBICNSTest::RtBug41083::ResultSet'; +1; diff --git a/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm b/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm new file mode 100644 index 0000000..a0264c6 --- /dev/null +++ b/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm @@ -0,0 +1,5 @@ +package DBICNSTest::RtBug41083::ResultSet_A::A; +use strict; +use warnings; +use base 'DBICNSTest::RtBug41083::ResultSet'; +1; diff --git a/t/lib/DBICNSTest/RtBug41083/Schema/A.pm b/t/lib/DBICNSTest/RtBug41083/Schema/A.pm new file mode 100644 index 0000000..f26fb19 --- /dev/null +++ b/t/lib/DBICNSTest/RtBug41083/Schema/A.pm @@ -0,0 +1,8 @@ +package DBICNSTest::RtBug41083::Schema::A; +use strict; +use warnings; +use base 'DBIx::Class'; +__PACKAGE__->load_components('Core'); +__PACKAGE__->table('a'); +__PACKAGE__->add_columns('a'); +1; diff --git a/t/lib/DBICNSTest/RtBug41083/Schema/A/Sub.pm b/t/lib/DBICNSTest/RtBug41083/Schema/A/Sub.pm new file mode 100644 index 0000000..c18de2d --- /dev/null +++ b/t/lib/DBICNSTest/RtBug41083/Schema/A/Sub.pm @@ -0,0 +1,5 @@ +package DBICNSTest::RtBug41083::Schema::A::Sub; +use strict; +use warnings; +use base 'DBICNSTest::RtBug41083::Schema::A'; +1; diff --git a/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm b/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm new file mode 100644 index 0000000..ca626d7 --- /dev/null +++ b/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm @@ -0,0 +1,8 @@ +package DBICNSTest::RtBug41083::Schema_A::A; +use strict; +use warnings; +use base 'DBIx::Class'; +__PACKAGE__->load_components('Core'); +__PACKAGE__->table('a'); +__PACKAGE__->add_columns('a'); +1; diff --git a/t/lib/DBICNSTest/RtBug41083/Schema_A/A/Sub.pm b/t/lib/DBICNSTest/RtBug41083/Schema_A/A/Sub.pm new file mode 100644 index 0000000..1128e1e --- /dev/null +++ b/t/lib/DBICNSTest/RtBug41083/Schema_A/A/Sub.pm @@ -0,0 +1,5 @@ +package DBICNSTest::RtBug41083::Schema_A::A::Sub; +use strict; +use warnings; +use base 'DBICNSTest::RtBug41083::Schema_A::A'; +1;