From: Matt S Trout Date: Mon, 12 Dec 2005 12:07:29 +0000 (+0000) Subject: Test and fix to Storage::DBI from Justin DeVuyst X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a4b2f17b810cea88ea194fb2fd3ed322f1129c6e;p=dbsrgits%2FDBIx-Class-Historic.git Test and fix to Storage::DBI from Justin DeVuyst --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index f53b008..3c935d8 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -191,7 +191,7 @@ sub _execute { sub insert { my ($self, $ident, $to_insert) = @_; $self->throw( "Couldn't insert ".join(', ', map "$_ => $to_insert->{$_}", keys %$to_insert)." into ${ident}" ) - unless ($self->_execute('insert' => [], $ident, $to_insert) > 0); + unless ($self->_execute('insert' => [], $ident, $to_insert)); return $to_insert; } diff --git a/t/18inserterror.t b/t/18inserterror.t new file mode 100644 index 0000000..043cec5 --- /dev/null +++ b/t/18inserterror.t @@ -0,0 +1,25 @@ +use Class::C3; +use strict; +use Test::More; +use warnings; + +BEGIN { + eval "use DBD::SQLite"; + plan $@ + ? ( skip_all => 'needs DBD::SQLite for testing' ) + : ( tests => 3 ); +} + +use lib qw(t/lib); + +use_ok( 'DBICTest' ); + +use_ok( 'DBICTest::Schema' ); + +{ + my $warnings; + local $SIG{__WARN__} = sub { $warnings .= $_[0] }; + eval { DBICTest::CD->create({ title => 'vacation in antarctica' }) }; + ok( $warnings !~ /uninitialized value/, "No warning from Storage" ); +} +