[Bps-public-commit] r18990 - DBIx-CheckConnectivity/t

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Mar 30 21:54:12 EDT 2009


Author: sunnavy
Date: Mon Mar 30 21:54:12 2009
New Revision: 18990

Modified:
   DBIx-CheckConnectivity/t/01.check.t

Log:
test the list context

Modified: DBIx-CheckConnectivity/t/01.check.t
==============================================================================
--- DBIx-CheckConnectivity/t/01.check.t	(original)
+++ DBIx-CheckConnectivity/t/01.check.t	Mon Mar 30 21:54:12 2009
@@ -1,13 +1,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 21;
+use Test::More tests => 27;
 use_ok('DBIx::CheckConnectivity');
 use_ok('DBIx::CheckConnectivity::Driver::SQLite');
 use_ok('DBIx::CheckConnectivity::Driver::Pg');
 use_ok('DBIx::CheckConnectivity::Driver::mysql');
 
-
 my $error;
 
 use Test::MockModule;
@@ -28,15 +27,15 @@
         );
 
         if ( $dsn =~ /not_exist/ ) {
-                if ( $dsn =~ /mysql/ ) {
-                    DBI::errstr('unknown database');
-                }
-                elsif ( $dsn =~ /Pg/ ) {
-                    DBI::errstr('not exist');
-                }
-                else {
-                    DBI::errstr('');
-                }
+            if ( $dsn =~ /mysql/ ) {
+                DBI::errstr('unknown database');
+            }
+            elsif ( $dsn =~ /Pg/ ) {
+                DBI::errstr('not exist');
+            }
+            else {
+                DBI::errstr('');
+            }
         }
         elsif ( $password =~ /wrong/ ) {
             DBI::errstr('wrong password');
@@ -70,9 +69,19 @@
 ok( !check_connectivity( dsn => 'dbi:Pg:database=not_exist;' ),
     'pg with not_exist db' );
 is( $error, 'not exist', 'err' );
+is_deeply(
+    [ check_connectivity( dsn => 'dbi:Pg:database=not_exist;' ) ],
+    [ undef, 'not exist' ],
+    'list context'
+);
 ok( !check_connectivity( dsn => 'dbi:mysql:database=not_exist;' ),
     'mysql with not_exist db' );
 is( $error, 'unknown database', 'err' );
+is_deeply(
+    [ check_connectivity( dsn => 'dbi:mysql:database=not_exist;' ) ],
+    [ undef, 'unknown database' ],
+    'list context'
+);
 
 ok(
     !check_connectivity(
@@ -82,3 +91,8 @@
     'pg with wrong password'
 );
 is( $error, 'wrong password', 'err' );
+is_deeply(
+    [ check_connectivity( dsn => 'dbi:Pg:database=xx;', password => 'wrong' ) ],
+    [ undef, 'wrong password' ],
+    'list context'
+);



More information about the Bps-public-commit mailing list