Skip to content

Commit

Permalink
[t/99-common.pl6] grow the new common test script to 9 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Berends committed May 31, 2010
1 parent c9d0374 commit c09de42
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions t/99-common.pl6
Expand Up @@ -5,16 +5,8 @@
#use Test; # "use" dies in a runtime eval
#use FakeDBI;

#my $program_name = $*PROGRAM_NAME;
#diag "program $program_name";
diag "program $*PROGRAM_NAME";
#$program_name ~~ / \d+ '-' (.+?) '-' common /;
if $*PROGRAM_NAME ~~ / <digit>+ '-' (.+?) '-' common / {
my $name = ~$0;
diag "name = $name";
}
diag "Testing FakeDBD::$mdriver";
plan 4;
plan 9;

# Verify that the driver loads before attempting a connect
my $drh = FakeDBI.install_driver($mdriver);
Expand All @@ -27,6 +19,26 @@ ok $drh_version > 0, "FakeDBD::$mdriver version $drh_version"; # test 2
my $dbh = FakeDBI.connect( $test_dsn, $test_user, $test_password );
ok $dbh, "connect to $test_dsn"; # test 3

# Drop a table of the same name so that the following create can work
my $rc = $dbh.do("DROP TABLE nom");
isnt $rc, Bool::True, "do: drop table gave an expected error"; # test 4

# Use 'do' to create a table
$rc = $dbh.do( "
CREATE TABLE nom (
name char(4),
description char(30),
quantity int,
price numeric(5,2)
)
");
is $rc, Bool::True, "do: create table nom"; # test 5
skip 1, "err after successful create should be 0";
#is $dbh.err, 0, "err after successful create should be 0"; # test 6
is $dbh.errstr, Any, "errstr after successful create should be Any"; # test 7

ok $dbh.do("DROP TABLE nom"), "final cleanup";

ok $dbh.disconnect, "disconnect";

# Return an unabiguous sign of successful completion
Expand Down

0 comments on commit c09de42

Please sign in to comment.