Skip to content

Commit 930e28b

Browse files
Fixed more tests
1 parent d67d4c3 commit 930e28b

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

tests/duckdb/test_to_create_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ TEST(duckdb, test_to_create_table) {
1818
sqlgen::transpilation::to_create_table<TestTable>();
1919
const auto conn = sqlgen::duckdb::connect().value();
2020
const auto expected =
21-
R"(CREATE TABLE IF NOT EXISTS "TestTable" ("field1" TEXT NOT NULL, "field2" INTEGER NOT NULL, "id" UINTEGER NOT NULL, "nullable" TEXT, PRIMARY KEY ("id"));)";
21+
R"(CREATE TABLE IF NOT EXISTS "TestTable"("field1" TEXT NOT NULL, "field2" INTEGER NOT NULL, "id" UINTEGER NOT NULL, "nullable" TEXT, PRIMARY KEY ("id"));)";
2222

2323
EXPECT_EQ(conn->to_sql(create_table_stmt), expected);
2424
}

tests/duckdb/test_to_insert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TEST(duckdb, test_to_insert) {
2020
sqlgen::dynamic::Insert>();
2121
const auto conn = sqlgen::duckdb::connect().value();
2222
const auto expected =
23-
R"(INSERT INTO "TestTable" ("field1", "field2", "id", "nullable") VALUES (?, ?, ?, ?);)";
23+
R"(INSERT INTO "TestTable" BY NAME ( SELECT "field1" AS "field1", "field2" AS "field2", "id" AS "id", "nullable" AS "nullable" FROM sqlgen_appended_data);)";
2424

2525
EXPECT_EQ(conn->to_sql(insert_stmt), expected);
2626
}

tests/duckdb/test_to_insert_or_replace.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ TEST(duckdb, test_to_insert_or_replace) {
2424
sqlgen::transpilation::to_insert_or_write<TestTable,
2525
sqlgen::dynamic::Insert>(true);
2626
const auto conn = sqlgen::duckdb::connect().value();
27+
2728
const auto expected =
28-
R"(INSERT INTO "TestTable" ("field1", "field2", "field3", "id", "nullable") VALUES (?, ?, ?, ?, ?) ON CONFLICT (field3, id) DO UPDATE SET field1=excluded.field1, field2=excluded.field2, field3=excluded.field3, id=excluded.id, nullable=excluded.nullable;)";
29+
R"(INSERT OR REPLACE INTO "TestTable" BY NAME ( SELECT "field1" AS "field1", "field2" AS "field2", "field3" AS "field3", "id" AS "id", "nullable" AS "nullable" FROM sqlgen_appended_data);)";
2930

3031
EXPECT_EQ(conn->to_sql(insert_stmt), expected);
3132
}

tests/duckdb/test_unique.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TEST(duckdb, test_unique) {
3737
.value();
3838

3939
const std::string expected_query =
40-
R"(CREATE TABLE IF NOT EXISTS "Person" ("id" UINTEGER NOT NULL, "first_name" TEXT NOT NULL UNIQUE, "last_name" TEXT NOT NULL, "age" DOUBLE NOT NULL, PRIMARY KEY ("id"));)";
40+
R"(CREATE TABLE IF NOT EXISTS "Person"("id" UINTEGER NOT NULL, "first_name" TEXT NOT NULL UNIQUE, "last_name" TEXT NOT NULL, "age" DOUBLE NOT NULL, PRIMARY KEY ("id"));)";
4141

4242
EXPECT_EQ(duckdb::to_sql(create_table<Person>), expected_query);
4343
}

0 commit comments

Comments
 (0)