Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Verify that a query with no results has a falsy value
  • Loading branch information
hoelzro committed Jun 29, 2015
1 parent 36e66e8 commit b8260de
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 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 42;
plan 43;

sub magic_cmp(@a, @b) {
my $res = @a[0] eq @b[0]
Expand Down Expand Up @@ -226,6 +226,16 @@ $sth.finish;
}
}

# test that a query with no results has a falsy value
{
$sth = $dbh.prepare('SELECT * FROM nom WHERE 1 = 0');
$sth.execute;

my $row = $sth.fetchrow-hash;

ok !?$row, 'a query with no 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 b8260de

Please sign in to comment.