[Bast-commits] r5995 - DBIx-Class/0.08/trunk/t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Apr 28 09:12:33 GMT 2009
Author: ribasushi
Date: 2009-04-28 10:12:33 +0100 (Tue, 28 Apr 2009)
New Revision: 5995
Modified:
DBIx-Class/0.08/trunk/t/64db.t
DBIx-Class/0.08/trunk/t/72pg.t
DBIx-Class/0.08/trunk/t/81transactions.t
Log:
Fix a todo and some minor test adjustments
Modified: DBIx-Class/0.08/trunk/t/64db.t
===================================================================
--- DBIx-Class/0.08/trunk/t/64db.t 2009-04-28 07:05:53 UTC (rev 5994)
+++ DBIx-Class/0.08/trunk/t/64db.t 2009-04-28 09:12:33 UTC (rev 5995)
@@ -64,7 +64,12 @@
'rank' => {
'data_type' => 'integer',
'is_nullable' => 0,
+ 'default_value' => '13',
},
+ 'charfield' => {
+ 'data_type' => 'char',
+ 'is_nullable' => 1,
+ },
},
'Correctly retrieve column info (mixed null and non-null columns)'
);
Modified: DBIx-Class/0.08/trunk/t/72pg.t
===================================================================
--- DBIx-Class/0.08/trunk/t/72pg.t 2009-04-28 07:05:53 UTC (rev 5994)
+++ DBIx-Class/0.08/trunk/t/72pg.t 2009-04-28 09:12:33 UTC (rev 5995)
@@ -162,7 +162,7 @@
my $count;
lives_ok {
$count = $schema->resultset('ArrayTest')->search({
- arrayfield => \[ '= ?' => [arrayfield => [3, 4]] ], #TODO anything less ugly than this?
+ arrayfield => \[ '= ?' => [arrayfield => [3, 4]] ], #Todo anything less ugly than this?
})->count;
} 'comparing arrayref to pg array data does not blow up';
is($count, 1, 'comparing arrayref to pg array data gives correct result');
Modified: DBIx-Class/0.08/trunk/t/81transactions.t
===================================================================
--- DBIx-Class/0.08/trunk/t/81transactions.t 2009-04-28 07:05:53 UTC (rev 5994)
+++ DBIx-Class/0.08/trunk/t/81transactions.t 2009-04-28 09:12:33 UTC (rev 5995)
@@ -272,41 +272,38 @@
ok(!$artist_rs->find({name => 'Death Cab for Cutie'}), "Artist not created");
- eval {
+ lives_ok (sub {
my $w;
local $SIG{__WARN__} = sub { $w = shift };
+ $schema->storage->debug (1);
+
# The 0 arg says don't die, just let the scope guard go out of scope
# forcing a txn_rollback to happen
outer($schema, 0);
like ($w, qr/A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or an error/, 'Out of scope warning detected');
- };
+ ok(!$artist_rs->find({name => 'Death Cab for Cutie'}), "Artist not created");
+ }, 'rollback successful withot exception');
- local $TODO = "Work out how this should work";
- is($@, "Not sure what we want here, but something", "Rollback okay");
-
- ok(!$artist_rs->find({name => 'Death Cab for Cutie'}), "Artist not created");
-
sub outer {
my ($schema) = @_;
-
+
my $guard = $schema->txn_scope_guard;
$schema->resultset('Artist')->create({
name => 'Death Cab for Cutie',
});
inner(@_);
- $guard->commit;
}
sub inner {
my ($schema, $fatal) = @_;
- my $guard = $schema->txn_scope_guard;
+ my $inner_guard = $schema->txn_scope_guard;
+ is($schema->storage->transaction_depth, 2, "Correct transaction depth");
+
my $artist = $artist_rs->find({ name => 'Death Cab for Cutie' });
- is($schema->storage->transaction_depth, 2, "Correct transaction depth");
- undef $@;
eval {
$artist->cds->create({
title => 'Plans',
@@ -320,6 +317,7 @@
die $@;
}
- # See what happens if we dont $guard->commit;
+ # inner guard should commit without consequences
+ $inner_guard->commit;
}
}
More information about the Bast-commits
mailing list