X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F39load_namespaces_1.t;h=0f8ae1ee904eb4ceecb8180a32ae95165acc4495;hb=d07f715dddc9e64362a168cf05896e89002a1aca;hp=bf7838057988b90820b69cedac8616784a3edf5f;hpb=762deea27e3ebd9abc4045656242a762441fd4df;p=dbsrgits%2FDBIx-Class.git diff --git a/t/39load_namespaces_1.t b/t/39load_namespaces_1.t index bf78380..0f8ae1e 100644 --- a/t/39load_namespaces_1.t +++ b/t/39load_namespaces_1.t @@ -1,25 +1,21 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; -use Test::Warn; use lib qw(t/lib); use DBICTest; # do not remove even though it is not used -warnings_exist ( - sub { +my $warnings; +eval { + local $SIG{__WARN__} = sub { $warnings .= shift }; package DBICNSTest; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_namespaces; - }, - [ - qr/load_namespaces found ResultSet class C with no corresponding Result class/, - qr/load_namespaces found ResultSet class DBICNSTest::ResultSet::D that does not subclass DBIx::Class::ResultSet/, - ], - 'Found warning about extra ResultSet classes, and incorrectly subclassed ResultSets', -); +}; +ok(!$@, 'load_namespaces doesnt die') or diag $@; +like($warnings, qr/load_namespaces found ResultSet class 'DBICNSTest::ResultSet::C' with no corresponding Result class/, 'Found warning about extra ResultSet classes'); + +like($warnings, qr/load_namespaces found ResultSet class 'DBICNSTest::ResultSet::D' that does not subclass DBIx::Class::ResultSet/, 'Found warning about ResultSets with incorrect subclass'); my $source_a = DBICNSTest->source('A'); isa_ok($source_a, 'DBIx::Class::ResultSource::Table');