Skip to content

Commit

Permalink
Fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Aug 26, 2024
1 parent b148409 commit 6798c27
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/common-tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -3633,6 +3633,8 @@ TEST_CASE_METHOD(common_tests, "Basic logging support", "[core][logging]")
std::ostringstream log;
sql.set_log_stream(&log);

auto_table_creator tableCreator(tc_.table_creator_1(sql));

try
{
sql << "drop table soci_test1";
Expand All @@ -3644,16 +3646,12 @@ TEST_CASE_METHOD(common_tests, "Basic logging support", "[core][logging]")

sql.set_log_stream(NULL);

try
{
int val1 = 1;
std::string val2 = "b";
sql << "insert into soci_test2 (a,b) values (:first,:second)", use(val1), use(val2);
}
catch (...) {}
int id = 1;
std::string name = "b";
sql << "insert into soci_test (name,id) values (:name,:id)", use(name, "name"), use(id, "id");

CHECK(sql.get_last_query() == "insert into soci_test2 (a,b) values (:first,:second)");
CHECK(sql.get_last_query() == "insert into soci_test2 (a,b) values (:first,:second) with :first=1, :second=\"b\"");
CHECK(sql.get_last_query() == "insert into soci_test (name,id) values (:name,:id)");
CHECK(sql.get_last_query_with_context() == "insert into soci_test (name,id) values (:name,:id) with :name=\"b\", :id=1");

sql.set_log_stream(&log);

Expand Down

0 comments on commit 6798c27

Please sign in to comment.