Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[t] skp all tests if the first connect throws an error
  • Loading branch information
moritz committed May 12, 2012
1 parent 77f8857 commit b3973e7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
14 changes: 12 additions & 2 deletions t/10-mysql.t
Expand Up @@ -75,10 +75,20 @@ ok $drh_version > 0, "DBDish::mysql version $drh_version"; # test 2
#ok defined $dbh, "Connected to database";
#ok $dbh->disconnect();
#
my $dbh = DBIish.connect($mdriver, :user($test_user), :password($test_password),
my $dbh = try {
CATCH { default {
diag "Connect failed with error $_";
skip 'connect failed -- missing prereqs?', 85;
exit;

}}

DBIish.connect($mdriver, :user($test_user), :password($test_password),
:$host, :$port, :$database,
RaiseError => 1, PrintError => 1, AutoCommit => 0
);
);
}

# die "ERROR: {DBIish.errstr}. Can't continue test" if $!.defined;
ok $dbh.defined, "Connected to database"; # test 3
my $result = $dbh.disconnect();
Expand Down
12 changes: 11 additions & 1 deletion t/99-common.pl6
Expand Up @@ -27,7 +27,17 @@ $drh_version = $drh.Version;
ok $drh_version > 0, "MiniDBD::$*mdriver version $drh_version"; # test 2

# Connect to the data sourcequantity*price AS amount FROM nom
my $dbh = DBIish.connect( $*mdriver, |%*opts, :RaiseError<1> );
my $dbh;
try {
$dbh = DBIish.connect( $*mdriver, |%*opts, :RaiseError<1> );
CATCH {
default {
diag "Connect failed with error $_";
skip 'connect failed -- maybe the prerequisits are not installed?', 38;
exit;
}
}
}
ok $dbh, "connect to %*opts<database>"; # test 3

try eval '$*post_connect_cb.($dbh)';
Expand Down

0 comments on commit b3973e7

Please sign in to comment.