Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure exhausted statements have falsy results
  • Loading branch information
hoelzro committed Jun 30, 2015
1 parent fbe5826 commit 03738e3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion t/99-common.pl6
Expand Up @@ -5,7 +5,7 @@
#use Test; # "use" dies in a runtime EVAL
#use DBIish;
diag "Testing MiniDBD::$*mdriver";
plan 43;
plan 44;

sub magic_cmp(@a, @b) {
my $res = @a[0] eq @b[0]
Expand Down Expand Up @@ -236,6 +236,17 @@ $sth.finish;
ok !?$row, 'a query with no results should have a falsy value';
}

# test that a query that's exhausted its result set has a falsy value
{
$sth = $dbh.prepare('SELECT COUNT(*) FROM nom');
$sth.execute;

my $row = $sth.fetchrow-hash;
$row = $sth.fetchrow-hash;

ok !?$row, 'a query with no more results should have a falsy value';
}


# Drop the table when finished, and disconnect
ok $dbh.do("DROP TABLE nom"), "final cleanup";
Expand Down

0 comments on commit 03738e3

Please sign in to comment.