X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F751msaccess.t;h=2b70a4aec5a7b3b9198a9c148567a69684734b87;hb=8aae794001ecccdb26c2bbd1b92c97bba9e65d79;hp=b7387831559092cefafb09148c00bf8c243fbaae;hpb=c7e856308aeac1faa6f4d8ad59da096e009d70f4;p=dbsrgits%2FDBIx-Class.git diff --git a/t/751msaccess.t b/t/751msaccess.t index b738783..2b70a4a 100644 --- a/t/751msaccess.t +++ b/t/751msaccess.t @@ -1,12 +1,13 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; use Test::Exception; -use Scope::Guard (); -use Try::Tiny; use DBIx::Class::Optional::Dependencies (); -use lib qw(t/lib); +use DBIx::Class::_Util 'scope_guard'; + use DBICTest; my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSACCESS_ODBC_${_}" } qw/DSN USER PASS/}; @@ -62,7 +63,7 @@ foreach my $info (@info) { LongReadLen => $maxloblen, }); - my $guard = Scope::Guard->new(sub { cleanup($schema) }); + my $guard = scope_guard { cleanup($schema) }; my $dbh = $schema->storage->dbh; @@ -142,37 +143,38 @@ EOF title => 'my track', }); - my $joined_track = try { - $schema->resultset('Artist')->search({ + my $joined_track; + lives_ok { + $joined_track = $schema->resultset('Artist')->search({ artistid => $first_artistid, }, { join => [{ cds => 'tracks' }], '+select' => [ 'tracks.title' ], '+as' => [ 'track_title' ], })->next; - } - catch { - diag "Could not execute two-step left join: $_"; - }; + } 'Two-step left join executed'; - is try { $joined_track->get_column('track_title') }, 'my track', - 'two-step left join works'; + is( + eval { $joined_track->get_column('track_title') }, + 'my track', + 'two-step left join works' + ); - $joined_artist = try { - $schema->resultset('Track')->search({ + lives_ok { + $joined_artist = $schema->resultset('Track')->search({ trackid => $track->trackid, }, { join => [{ cd => 'artist' }], '+select' => [ 'artist.name' ], '+as' => [ 'artist_name' ], })->next; - } - catch { - diag "Could not execute two-step inner join: $_"; - }; + } 'Two-step inner join executed'; - is try { $joined_artist->get_column('artist_name') }, 'foo', - 'two-step inner join works'; + is( + eval { $joined_artist->get_column('artist_name') }, + 'foo', + 'two-step inner join works' + ); # test basic transactions $schema->txn_do(sub { @@ -287,9 +289,7 @@ EOF id INT NOT NULL PRIMARY KEY, bytea INT NULL, blob IMAGE NULL, - blob2 IMAGE NULL, clob TEXT NULL, - clob2 TEXT NULL, a_memo MEMO NULL ) ],{ RaiseError => 1, PrintError => 1 });