develooper Front page | perl.dbd.oracle.changes | Postings from March 2012

[svn:dbd-oracle] r15217 - dbd-oracle/trunk/t

From:
yanick
Date:
March 13, 2012 08:01
Subject:
[svn:dbd-oracle] r15217 - dbd-oracle/trunk/t
Message ID:
20120313150117.7B568184BA1@xx12.develooper.com
Author: yanick
Date: Tue Mar 13 08:01:17 2012
New Revision: 15217

Modified:
   dbd-oracle/trunk/t/01base.t
   dbd-oracle/trunk/t/38taf.t

Log:
tidying code

Modified: dbd-oracle/trunk/t/01base.t
==============================================================================
--- dbd-oracle/trunk/t/01base.t	(original)
+++ dbd-oracle/trunk/t/01base.t	Tue Mar 13 08:01:17 2012
@@ -1,5 +1,8 @@
 #!perl -w
 
+use strict;
+use warnings;
+
 # Base DBD Driver Test
 use Test::More tests => 6;
 
@@ -8,45 +11,23 @@
 eval {
     import DBI;
 };
-ok(!$@, 'import DBI');
 
-$switch = DBI->internal;
-is(ref $switch, 'DBI::dr', 'internal');
+is $@ => '', 'successfully import DBI';
 
-eval {
+is ref DBI->internal => 'DBI::dr', 'internal';
+
+my $drh = eval {
     # This is a special case. install_driver should not normally be used.
-    $drh = DBI->install_driver('Oracle');
+    DBI->install_driver('Oracle');
 };
-my $ev = $@;
-ok(!$ev, 'install_driver');
-if ($ev) {
-    $ev =~ s/\n\n+/\n/g;
-    warn "Failed to load Oracle extension and/or shared libraries:\n$@";
-    warn "The remaining tests will probably also fail with the same error.\a\n\n";
-    # try to provide some useful pointers for some cases
-    if ($@ =~ /Solaris patch.*Java/i) {
-	warn "*** Please read the README.java.txt file for help. ***\n";
-    }
-    else {
-	warn "*** Please read the README and README.help.txt files for help. ***\n";
-    }
-    warn "\n";
-    sleep 5;
 
-}
+is $@ => '', 'install_driver' 
+    or diag "Failed to load Oracle extension and/or shared libraries";
 
 SKIP: {
-    skip 'install_driver failed - skipping remaining', 2 if $ev;
+    skip 'install_driver failed - skipping remaining', 2 if $@;
 
-    is(ref $drh, 'DBI::dr', 'install_driver');
+    is ref $drh => 'DBI::dr', 'install_driver';
 
-    ok($drh->{Version}, 'version');
+    ok $drh->{Version}, 'version';
 }
-
-# end.
-
-__END__
-
-You must install a Solaris patch to run this version of
-the Java runtime.
-Please see the README and release notes for more information.

Modified: dbd-oracle/trunk/t/38taf.t
==============================================================================
--- dbd-oracle/trunk/t/38taf.t	(original)
+++ dbd-oracle/trunk/t/38taf.t	Tue Mar 13 08:01:17 2012
@@ -15,22 +15,15 @@
 # create a database handle
 my $dsn = oracle_test_dsn();
 my $dbuser = $ENV{ORACLE_USERID} || 'scott/tiger';
-my $dbh;
-eval {$dbh = DBI->connect($dsn, $dbuser, '',)};
-if ($dbh) {
-    if ($dbh->ora_can_taf()){
-      plan tests => 1;  
-    }
-    else {
-       plan tests =>1;      
-    }
-} else {
-    plan skip_all => "Unable to connect to Oracle";
-}
+
+my $dbh = eval { DBI->connect($dsn, $dbuser, '',) }
+    or plan skip_all => "Unable to connect to Oracle";
+
+plan tests => 1;  
 
 $dbh->disconnect;
 
-if (!$dbh->ora_can_taf()){
+if ( !$dbh->ora_can_taf ){
     
   eval {$dbh = DBI->connect($dsn, $dbuser, '',{ora_taf=>1,taf_sleep=>15,ora_taf_function=>'taf'})};   
   ok($@    =~ /You are attempting to enable TAF/, "'$@' expected! ");      
@@ -38,11 +31,10 @@
     
 }
 else {
-   ok($dbh = DBI->connect($dsn, $dbuser, '',{ora_taf=>1,taf_sleep=>15,ora_taf_function=>'taf'}),"Well this is all I can test!");         
+   ok $dbh = DBI->connect($dsn, $dbuser, '',{
+           ora_taf=>1,taf_sleep=>15,ora_taf_function=>'taf'
+    });
     
 }
 
 $dbh->disconnect;
-#not much I can do with taf as I cannot really shut down somones server pephaps later
-
-1;



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About