diff options
author | Mahmoud Mandour <ma.mandourr@gmail.com> | 2021-09-17 20:49:49 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-04 15:51:48 +0200 |
commit | 235573f7baa716d0ce58e1f496a133b6616fe17f (patch) | |
tree | a46a93c02ef6d0094f321be1d34bd261c1966460 /Tests | |
parent | 4df85840c3888c79d9b0c1080c53e4b466b6dd45 (diff) | |
download | serenity-235573f7baa716d0ce58e1f496a133b6616fe17f.zip |
LibSQL: Test INSERT statement with wrong number of values
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibSQL/TestSqlStatementExecution.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/LibSQL/TestSqlStatementExecution.cpp b/Tests/LibSQL/TestSqlStatementExecution.cpp index bc206dc138..d190006775 100644 --- a/Tests/LibSQL/TestSqlStatementExecution.cpp +++ b/Tests/LibSQL/TestSqlStatementExecution.cpp @@ -104,6 +104,16 @@ TEST_CASE(insert_into_table_multiple_tuples_wrong_data_types) EXPECT(result->error().code == SQL::SQLErrorCode::InvalidValueType); } +TEST_CASE(insert_wrong_number_of_values) +{ + ScopeGuard guard([]() { unlink(db_name); }); + auto database = SQL::Database::construct(db_name); + create_table(database); + auto result = execute(database, "INSERT INTO TestSchema.TestTable VALUES ( 42 );"); + EXPECT(result->error().code == SQL::SQLErrorCode::InvalidNumberOfValues); + EXPECT(result->inserted() == 0); +} + TEST_CASE(select_from_table) { ScopeGuard guard([]() { unlink(db_name); }); |