Remove use of Try::Tiny entirely (the missing part of ddcc02d1)
[dbsrgits/DBIx-Class.git] / t / 73oracle_blob.t
index 22a98c4..6e5c903 100644 (file)
@@ -1,13 +1,11 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_oracle';
+
 use strict;
 use warnings;
 
 use Test::Exception;
 use Test::More;
-use Sub::Name;
-use Try::Tiny;
-use DBIx::Class::Optional::Dependencies ();
-
-use lib qw(t/lib);
 
 use DBICTest::Schema::BindType;
 BEGIN {
@@ -25,18 +23,12 @@ BEGIN {
 
 use DBICTest;
 
-my ($dsn,  $user,  $pass)  = @ENV{map { "DBICTEST_ORA_${_}" }  qw/DSN USER PASS/};
-
-plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.'
-  unless ($dsn && $user && $pass);
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle')
-  unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle');
-
 $ENV{NLS_SORT} = "BINARY";
 $ENV{NLS_COMP} = "BINARY";
 $ENV{NLS_LANG} = "AMERICAN";
 
+my ($dsn,  $user,  $pass)  = @ENV{map { "DBICTEST_ORA_${_}" }  qw/DSN USER PASS/};
+
 my $v = do {
   my $si = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info;
   $si->{normalized_dbms_version}
@@ -112,10 +104,14 @@ SKIP: {
       'multi-part LOB equality query was not cached',
     ) if $size eq 'large';
     is @objs, 1, 'One row found matching on both LOBs';
-    ok (try { $objs[0]->blob }||'' eq "blob:$str", 'blob inserted/retrieved correctly');
-    ok (try { $objs[0]->clob }||'' eq "clob:$str", 'clob inserted/retrieved correctly');
-    ok (try { $objs[0]->clb2 }||'' eq "clb2:$str", "clb2 inserted correctly");
-    ok (try { $objs[0]->blb2 }||'' eq "blb2:$str", "blb2 inserted correctly");
+
+    for my $type (qw( blob clob clb2 blb2 )) {
+      is (
+        eval { $objs[0]->$type },
+        "$type:$str",
+        "$type inserted/retrieved correctly"
+      );
+    }
 
     {
       local $TODO = '-like comparison on blobs not tested before ora 10 (fails on 8i)'
@@ -131,7 +127,7 @@ SKIP: {
       { blob => "blob:$str", clob => "clob:$str" },
       {
         from => \ "(SELECT * FROM ${q}bindtype_test${q} WHERE ${q}id${q} != ?) ${q}me${q}",
-        bind => [ [ undef => 12345678 ] ],
+        bind => [ [ {} => 12345678 ] ],
       }
     )->get_column('id')->as_query);
 
@@ -145,10 +141,14 @@ SKIP: {
 
     @objs = $rs->search({ blob => "updated blob", clob => 'updated clob' })->all;
     is @objs, 1, 'found updated row';
-    ok (try { $objs[0]->blob }||'' eq "updated blob", 'blob updated/retrieved correctly');
-    ok (try { $objs[0]->clob }||'' eq "updated clob", 'clob updated/retrieved correctly');
-    ok (try { $objs[0]->clb2 }||'' eq "updated clb2", "clb2 updated correctly");
-    ok (try { $objs[0]->blb2 }||'' eq "updated blb2", "blb2 updated correctly");
+
+    for my $type (qw( blob clob clb2 blb2 )) {
+      is (
+        eval { $objs[0]->$type },
+        "updated $type",
+        "$type updated/retrieved correctly"
+      );
+    }
 
     lives_ok {
       $rs->search({ id => $id  })
@@ -157,8 +157,14 @@ SKIP: {
 
     @objs = $rs->search({ blob => 're-updated blob', clob => 're-updated clob' })->all;
     is @objs, 1, 'found updated row';
-    ok (try { $objs[0]->blob }||'' eq 're-updated blob', 'blob updated/retrieved correctly');
-    ok (try { $objs[0]->clob }||'' eq 're-updated clob', 'clob updated/retrieved correctly');
+
+    for my $type (qw( blob clob )) {
+      is (
+        eval { $objs[0]->$type },
+        "re-updated $type",
+        "$type updated/retrieved correctly"
+      );
+    }
 
     lives_ok {
       $rs->search({ blob => "re-updated blob", clob => "re-updated clob" })