From: Jason M. Mills Date: Fri, 13 Mar 2009 12:32:35 +0000 (+0000) Subject: Added test for source sub-class register_extra_sources warning. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=55f02c6de268b8e04c531432e46e43a1f84af5d5;p=dbsrgits%2FDBIx-Class-Historic.git Added test for source sub-class register_extra_sources warning. Sub-classes should not generate this warning - bug via non-inhertiance sorting via register_source. --- diff --git a/t/39load_namespaces_rt41083.t b/t/39load_namespaces_rt41083.t index ba99fe5..7d8dc5c 100644 --- a/t/39load_namespaces_rt41083.t +++ b/t/39load_namespaces_rt41083.t @@ -6,7 +6,7 @@ use Test::More; use lib 't/lib'; -plan tests => 4; +plan tests => 6; sub _chk_warning { defined $_[0]? @@ -14,6 +14,11 @@ sub _chk_warning { 1 } +sub _chk_extra_sources_warning { + my $p = qr/already has a source, use register_extra_source for additional sources/; + defined $_[0]? $_[0] !~ /$p/ : 1; +} + my $warnings; eval { local $SIG{__WARN__} = sub { $warnings .= shift }; @@ -26,7 +31,9 @@ eval { ); }; ok(!$@) or diag $@; -ok(_chk_warning($warnings), 'expected no complaint'); +ok(_chk_warning($warnings), 'expected no resultset complaint'); +ok(_chk_extra_sources_warning($warnings), 'expected no extra sources complaint'); +undef $warnings; eval { local $SIG{__WARN__} = sub { $warnings .= shift }; @@ -39,4 +46,6 @@ eval { ); }; ok(!$@) or diag $@; -ok(_chk_warning($warnings), 'expected no complaint') or diag $warnings; +ok(_chk_warning($warnings), 'expected no resultset complaint') or diag $warnings; +ok(_chk_extra_sources_warning($warnings), 'expected no extra sources complaint'); +undef $warnings;