diff options
author | Mahmoud Mandour <ma.mandourr@gmail.com> | 2021-09-17 23:29:28 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-04 15:51:48 +0200 |
commit | 0e5b2c923df5a56fa3f4764932dee0f3b1d011dc (patch) | |
tree | 328b40f1b1feae6e089201e830f67b870dd9e44a | |
parent | 235573f7baa716d0ce58e1f496a133b6616fe17f (diff) | |
download | serenity-0e5b2c923df5a56fa3f4764932dee0f3b1d011dc.zip |
LibSQL: Add an INSERT without column names test
This adds a passing test of an insert statement that contains no column
names and assumes full tuple input
-rw-r--r-- | Tests/LibSQL/TestSqlStatementExecution.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/LibSQL/TestSqlStatementExecution.cpp b/Tests/LibSQL/TestSqlStatementExecution.cpp index d190006775..f01a7e2da0 100644 --- a/Tests/LibSQL/TestSqlStatementExecution.cpp +++ b/Tests/LibSQL/TestSqlStatementExecution.cpp @@ -114,6 +114,19 @@ TEST_CASE(insert_wrong_number_of_values) EXPECT(result->inserted() == 0); } +TEST_CASE(insert_without_column_names) +{ + ScopeGuard guard([]() { unlink(db_name); }); + auto database = SQL::Database::construct(db_name); + create_table(database); + auto result = execute(database, "INSERT INTO TestSchema.TestTable VALUES ('Test_1', 42), ('Test_2', 43);"); + EXPECT(result->error().code == SQL::SQLErrorCode::NoError); + EXPECT(result->inserted() == 2); + + auto table = database->get_table("TESTSCHEMA", "TESTTABLE"); + EXPECT_EQ(database->select_all(*table).size(), 2u); +} + TEST_CASE(select_from_table) { ScopeGuard guard([]() { unlink(db_name); }); |