Added weird passes/failes test
Jason M. Mills [Thu, 20 Nov 2008 15:29:29 +0000 (15:29 +0000)]
t/39load_namespaces_rt41083.t
t/lib/DBICNSTest/RtBug41083/ResultSet/A.pm [new file with mode: 0644]
t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm [new file with mode: 0644]
t/lib/DBICNSTest/RtBug41083/Schema/A.pm [new file with mode: 0644]
t/lib/DBICNSTest/RtBug41083/Schema/A/Sub.pm [new file with mode: 0644]
t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm [new file with mode: 0644]
t/lib/DBICNSTest/RtBug41083/Schema_A/A/Sub.pm [new file with mode: 0644]

index facb70f..88fd6b7 100644 (file)
@@ -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 (file)
index 0000000..d8bfa35
--- /dev/null
@@ -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 (file)
index 0000000..a0264c6
--- /dev/null
@@ -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 (file)
index 0000000..f26fb19
--- /dev/null
@@ -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 (file)
index 0000000..c18de2d
--- /dev/null
@@ -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 (file)
index 0000000..ca626d7
--- /dev/null
@@ -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 (file)
index 0000000..1128e1e
--- /dev/null
@@ -0,0 +1,5 @@
+package DBICNSTest::RtBug41083::Schema_A::A::Sub;
+use strict;
+use warnings;
+use base 'DBICNSTest::RtBug41083::Schema_A::A';
+1;