--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+unshift(@INC, './t/lib');
+
+plan tests => 9;
+
+my $warnings;
+eval {
+ local $SIG{__WARN__} = sub { $warnings .= shift };
+ package DBICNSTest;
+ use base qw/DBIx::Class::Schema/;
+ __PACKAGE__->load_namespaces( default_resultset_base => 'RSBase' );
+};
+ok(!$@) or diag $@;
+like($warnings, qr/load_namespaces found ResultSet class C with no corresponding ResultSource/);
+like($warnings, qr/load_namespaces found Result class C with no corresponding ResultSource/);
+
+my $source_a = DBICNSTest->source('A');
+isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
+my $rset_a = DBICNSTest->resultset('A');
+isa_ok($rset_a, 'DBICNSTest::ResultSet::A');
+my $resclass_a = DBICNSTest->resultset('A')->result_class;
+is($resclass_a, 'DBICNSTest::Result::A');
+
+my $source_b = DBICNSTest->source('B');
+isa_ok($source_b, 'DBIx::Class::ResultSource::Table');
+my $rset_b = DBICNSTest->resultset('B');
+isa_ok($rset_b, 'DBICNSTest::RSBase');
+my $resclass_b = DBICNSTest->resultset('B')->result_class;
+is($resclass_b, 'DBICNSTest::ResultSource::B');
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+unshift(@INC, './t/lib');
+
+plan tests => 9;
+
+my $warnings;
+eval {
+ local $SIG{__WARN__} = sub { $warnings .= shift };
+ package DBICNSTest;
+ use base qw/DBIx::Class::Schema/;
+ __PACKAGE__->load_namespaces;
+};
+ok(!$@) or diag $@;
+like($warnings, qr/load_namespaces found ResultSet class C with no corresponding ResultSource/);
+like($warnings, qr/load_namespaces found Result class C with no corresponding ResultSource/);
+
+my $source_a = DBICNSTest->source('A');
+isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
+my $rset_a = DBICNSTest->resultset('A');
+isa_ok($rset_a, 'DBICNSTest::ResultSet::A');
+my $resclass_a = DBICNSTest->resultset('A')->result_class;
+is($resclass_a, 'DBICNSTest::Result::A');
+
+my $source_b = DBICNSTest->source('B');
+isa_ok($source_b, 'DBIx::Class::ResultSource::Table');
+my $rset_b = DBICNSTest->resultset('B');
+isa_ok($rset_b, 'DBIx::Class::ResultSet');
+my $resclass_b = DBICNSTest->resultset('B')->result_class;
+is($resclass_b, 'DBICNSTest::ResultSource::B');
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+unshift(@INC, './t/lib');
+
+plan tests => 9;
+
+my $warnings;
+eval {
+ local $SIG{__WARN__} = sub { $warnings .= shift };
+ package DBICNSTestOther;
+ use base qw/DBIx::Class::Schema/;
+ __PACKAGE__->load_namespaces(
+ resultsource_namespace => '+DBICNSTest::RSrc',
+ resultset_namespace => '+DBICNSTest::RSet',
+ result_namespace => '+DBICNSTest::Res'
+ );
+};
+ok(!$@) or diag $@;
+like($warnings, qr/load_namespaces found ResultSet class C with no corresponding ResultSource/);
+like($warnings, qr/load_namespaces found Result class C with no corresponding ResultSource/);
+
+my $source_a = DBICNSTestOther->source('A');
+isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
+my $rset_a = DBICNSTestOther->resultset('A');
+isa_ok($rset_a, 'DBICNSTest::RSet::A');
+my $resclass_a = DBICNSTestOther->resultset('A')->result_class;
+is($resclass_a, 'DBICNSTest::Res::A');
+
+my $source_b = DBICNSTestOther->source('B');
+isa_ok($source_b, 'DBIx::Class::ResultSource::Table');
+my $rset_b = DBICNSTestOther->resultset('B');
+isa_ok($rset_b, 'DBIx::Class::ResultSet');
+my $resclass_b = DBICNSTestOther->resultset('B')->result_class;
+is($resclass_b, 'DBICNSTest::RSrc::B');
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+unshift(@INC, './t/lib');
+
+plan tests => 9;
+
+my $warnings;
+eval {
+ local $SIG{__WARN__} = sub { $warnings .= shift };
+ package DBICNSTest;
+ use base qw/DBIx::Class::Schema/;
+ __PACKAGE__->load_namespaces(
+ resultsource_namespace => 'RSrc',
+ resultset_namespace => 'RSet',
+ result_namespace => 'Res'
+ );
+};
+ok(!$@) or diag $@;
+like($warnings, qr/load_namespaces found ResultSet class C with no corresponding ResultSource/);
+like($warnings, qr/load_namespaces found Result class C with no corresponding ResultSource/);
+
+my $source_a = DBICNSTest->source('A');
+isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
+my $rset_a = DBICNSTest->resultset('A');
+isa_ok($rset_a, 'DBICNSTest::RSet::A');
+my $resclass_a = DBICNSTest->resultset('A')->result_class;
+is($resclass_a, 'DBICNSTest::Res::A');
+
+my $source_b = DBICNSTest->source('B');
+isa_ok($source_b, 'DBIx::Class::ResultSource::Table');
+my $rset_b = DBICNSTest->resultset('B');
+isa_ok($rset_b, 'DBIx::Class::ResultSet');
+my $resclass_b = DBICNSTest->resultset('B')->result_class;
+is($resclass_b, 'DBICNSTest::RSrc::B');
--- /dev/null
+package DBICNSTest::RSBase;
+use base qw/DBIx::Class::ResultSet/;
+1;
--- /dev/null
+package DBICNSTest::RSet::A;
+use base qw/DBIx::Class::ResultSet/;
+1;
--- /dev/null
+package DBICNSTest::RSet::C;
+use base qw/DBIx::Class::ResultSet/;
+1;
--- /dev/null
+package DBICNSTest::RSrc::A;
+use base qw/DBIx::Class/;
+__PACKAGE__->load_components(qw/PK::Auto Core/);
+__PACKAGE__->table('a');
+__PACKAGE__->add_columns('a');
+1;
--- /dev/null
+package DBICNSTest::RSrc::B;
+use base qw/DBIx::Class/;
+__PACKAGE__->load_components(qw/PK::Auto Core/);
+__PACKAGE__->table('b');
+__PACKAGE__->add_columns('b');
+1;
--- /dev/null
+package DBICTest::Res::A;
+use base qw/DBIx::Class::Row/;
+1;
--- /dev/null
+package DBICTest::Res::C;
+use base qw/DBIx::Class::Row/;
+1;
--- /dev/null
+package DBICTest::Result::A;
+use base qw/DBIx::Class::Row/;
+1;
--- /dev/null
+package DBICTest::Result::C;
+use base qw/DBIx::Class::Row/;
+1;
--- /dev/null
+package DBICNSTest::ResultSet::A;
+use base qw/DBIx::Class::ResultSet/;
+1;
--- /dev/null
+package DBICNSTest::ResultSet::C;
+use base qw/DBIx::Class::ResultSet/;
+1;
--- /dev/null
+package DBICNSTest::ResultSource::A;
+use base qw/DBIx::Class/;
+__PACKAGE__->load_components(qw/PK::Auto Core/);
+__PACKAGE__->table('a');
+__PACKAGE__->add_columns('a');
+1;
--- /dev/null
+package DBICNSTest::ResultSource::B;
+use base qw/DBIx::Class/;
+__PACKAGE__->load_components(qw/PK::Auto Core/);
+__PACKAGE__->table('b');
+__PACKAGE__->add_columns('b');
+1;