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
This commit is contained in:
Mahmoud Mandour 2021-09-17 23:29:28 +02:00 committed by Andreas Kling
parent 235573f7ba
commit 0e5b2c923d
Notes: sideshowbarker 2024-07-18 03:04:25 +09:00

View File

@ -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); });