[Rt-commit] r1985 - in DBIx-SearchBuilder/trunk: .
SearchBuilder/Handle t
jesse at bestpractical.com
jesse at bestpractical.com
Thu Dec 16 14:46:51 EST 2004
Author: jesse
Date: Sat Dec 11 15:35:46 2004
New Revision: 1985
Modified:
DBIx-SearchBuilder/trunk/ (props changed)
DBIx-SearchBuilder/trunk/Changes
DBIx-SearchBuilder/trunk/SearchBuilder.pm
DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm
DBIx-SearchBuilder/trunk/t/01records.t
Log:
r2407 at hualien: jesse | 2004-12-11T20:30:06.886872Z
Test suite additions from ruz
Modified: DBIx-SearchBuilder/trunk/Changes
==============================================================================
--- DBIx-SearchBuilder/trunk/Changes (original)
+++ DBIx-SearchBuilder/trunk/Changes Sat Dec 11 15:35:46 2004
@@ -1,5 +1,8 @@
Revision history for Perl extension DBIx::SearchBuilder.
+1.17_01
+ - More record tests from Ruz
+
1.16 Thu Dec 9 23:49:39 EST 2004
- Fixed a bug in D::SB::R::Cachable that could cause it to load the wrong row from the cache if you were loading
by alternate keys and had since changed one of the attributes of a previous row. This was unmasked by a
Modified: DBIx-SearchBuilder/trunk/SearchBuilder.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder.pm Sat Dec 11 15:35:46 2004
@@ -5,7 +5,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = "1.16";
+$VERSION = "1.17_01";
=head1 NAME
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Handle/SQLite.pm Sat Dec 11 15:35:46 2004
@@ -41,9 +41,7 @@
# We really don't want an empty id
my $sth = $self->SUPER::Insert($table, %args);
- if (!$sth) {
- return ($sth);
- }
+ return unless $sth;
# If we have set an id, then we want to use that, otherwise, we want to lookup the last _new_ rowid
$self->{'id'}= $args{'id'} || $self->dbh->func('last_insert_rowid');
Modified: DBIx-SearchBuilder/trunk/t/01records.t
==============================================================================
--- DBIx-SearchBuilder/trunk/t/01records.t (original)
+++ DBIx-SearchBuilder/trunk/t/01records.t Sat Dec 11 15:35:46 2004
@@ -9,7 +9,7 @@
if ($@) {
plan skip_all => "DBD::SQLite required for testing database interaction"
} else{
-plan tests => 23;
+plan tests => 31;
}
my $handle;
use_ok('DBIx::SearchBuilder::Handle::SQLite');
@@ -38,15 +38,32 @@
is($rec->id, $id, "The record has its id");
-
is ($rec->Name, 'Jesse', "The record's name is Jesse");
-my ($val,$msg) = $rec->SetName('Obra');
-
+my ($val, $msg) = $rec->SetName('Obra');
ok($val, $msg) ;
-
is($rec->Name, 'Obra', "We did actually change the name");
+# Validate immutability of the field id
+($val, $msg) = $rec->Setid( $rec->id + 1 );
+ok(!$val, $msg);
+is($msg, 'Immutable field', 'id is immutable field');
+is($rec->id, $id, "The record still has its id");
+
+# Check some non existant field
+ok( !eval{ $rec->SomeUnexpectedField }, "The record has no 'SomeUnexpectedField'");
+{
+ # test produce DBI warning
+ local $SIG{__WARN__} = sub {return};
+ is( $rec->_Value( 'SomeUnexpectedField' ), undef, "The record has no 'SomeUnexpectedField'");
+}
+($val, $msg) = $rec->SetSomeUnexpectedField( 'foo' );
+ok(!$val, $msg);
+is($msg, 'Nonexistant field?', "Field doesn't exist");
+($val, $msg) = $rec->_Set('SomeUnexpectedField', 'foo');
+ok(!$val, "$msg");
+
+
# Validate truncation on update
($val,$msg) = $rec->SetName('1234567890123456789012345678901234567890');
More information about the Rt-commit
mailing list