Skip to content

Commit

Permalink
Merge pull request #2120 from joto/add-test
Browse files Browse the repository at this point in the history
Add test to make sure unset pg_result_t behaves sensibly
  • Loading branch information
lonvia authored Jan 27, 2024
2 parents cb8b844 + c5ea1d4 commit 6375e05
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,13 @@ TEST_CASE("create table and insert something")
REQUIRE(result.num_tuples() == 0);
REQUIRE(result.affected_rows() == 2);
}

TEST_CASE("empty result object should return fatal status")
{
pg_result_t result;
REQUIRE(result.status() == PGRES_FATAL_ERROR);
REQUIRE_FALSE(result);
REQUIRE(result.num_fields() == 0);
REQUIRE(result.num_tuples() == 0);
REQUIRE(result.affected_rows() == 0);
}

0 comments on commit 6375e05

Please sign in to comment.