X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F751msaccess.t;h=2b70a4aec5a7b3b9198a9c148567a69684734b87;hb=8aae794001ecccdb26c2bbd1b92c97bba9e65d79;hp=cadf140d694cebda134ee03d33d032a740b435da;hpb=2c2bc4e58c2146670960fc1a0a2ae802cb650506;p=dbsrgits%2FDBIx-Class.git diff --git a/t/751msaccess.t b/t/751msaccess.t index cadf140..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/}; @@ -23,7 +24,6 @@ plan skip_all => 'Test needs ' . or (not $dsn || $dsn2); -require DBICTest::Schema; DBICTest::Schema->load_classes('ArtistGUID'); # Example DSNs (32bit only): @@ -63,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; @@ -143,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 {