Skip to content

Commit c5ea1d4

Browse files
committed
Add test to make sure unset pg_result_t behaves sensibly
1 parent 59bb561 commit c5ea1d4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test-pgsql.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,13 @@ TEST_CASE("create table and insert something")
135135
REQUIRE(result.num_tuples() == 0);
136136
REQUIRE(result.affected_rows() == 2);
137137
}
138+
139+
TEST_CASE("empty result object should return fatal status")
140+
{
141+
pg_result_t result;
142+
REQUIRE(result.status() == PGRES_FATAL_ERROR);
143+
REQUIRE_FALSE(result);
144+
REQUIRE(result.num_fields() == 0);
145+
REQUIRE(result.num_tuples() == 0);
146+
REQUIRE(result.affected_rows() == 0);
147+
}

0 commit comments

Comments
 (0)