From: Michael G Schwern Date: Fri, 24 Oct 2008 03:00:57 +0000 (+0000) Subject: Annoying DBD::SQLite warning is tripping up Test::NoWarnings. X-Git-Tag: v0.08240~315 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1f17ec275530f0586204c4cb6b05d97e0523df2a;p=dbsrgits%2FDBIx-Class.git Annoying DBD::SQLite warning is tripping up Test::NoWarnings. Work around it. --- diff --git a/Makefile.PL b/Makefile.PL index 573cddf..2fdc3ce 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -32,7 +32,6 @@ requires 'Encode' => 0 if ($] <= 5.008000); test_requires 'DBD::SQLite' => 1.13; test_requires 'Test::Builder' => 0.33; test_requires 'Test::Warn' => 0.11; -test_requires 'Test::NoWarnings' => 0.08; test_requires 'Test::Exception' => 0; install_script 'script/dbicadmin'; diff --git a/t/cdbi-t/set_to_undef.t b/t/cdbi-t/set_to_undef.t index 75e0ee6..792c55e 100644 --- a/t/cdbi-t/set_to_undef.t +++ b/t/cdbi-t/set_to_undef.t @@ -8,10 +8,15 @@ BEGIN { plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@" if $@; plan skip_all => "DateTime required" unless eval { require DateTime }; - plan tests => 1; + plan tests => 2; } -use Test::NoWarnings; + +# Don't use Test::NoWarnings because of an unrelated DBD::SQLite warning. +my @warnings; +local $SIG{__WARN__} = sub { + push @warnings, @_; +}; { package Thing; @@ -23,4 +28,7 @@ use Test::NoWarnings; my $thing = Thing->construct({ thing_id => 23, this => 42 }); $thing->set( this => undef ); +is $thing->get( "this" ), undef, 'undef set'; $thing->discard_changes; + +is @warnings, 0, 'no warnings';