Fix building on perls with no . in @INC
[dbsrgits/DBIx-Class.git] / t / 751msaccess.t
index b738783..2b70a4a 100644 (file)
@@ -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 });