mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibSQL: Test INSERT statement with wrong data types
This commit is contained in:
parent
6065383e05
commit
4df85840c3
Notes:
sideshowbarker
2024-07-18 03:04:33 +09:00
Author: https://github.com/i3abghany
Commit: 4df85840c3
Pull-request: https://github.com/SerenityOS/serenity/pull/10091
Issue: https://github.com/SerenityOS/serenity/issues/10028
Reviewed-by: https://github.com/JanDeVisser
Reviewed-by: https://github.com/davidot ✅
Reviewed-by: https://github.com/trflynn89
1 changed files with 20 additions and 0 deletions
|
@ -84,6 +84,26 @@ TEST_CASE(insert_into_table)
|
||||||
EXPECT_EQ(count, 1);
|
EXPECT_EQ(count, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(insert_into_table_wrong_data_types)
|
||||||
|
{
|
||||||
|
ScopeGuard guard([]() { unlink(db_name); });
|
||||||
|
auto database = SQL::Database::construct(db_name);
|
||||||
|
create_table(database);
|
||||||
|
auto result = execute(database, "INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES (43, 'Test_2');");
|
||||||
|
EXPECT(result->inserted() == 0);
|
||||||
|
EXPECT(result->error().code == SQL::SQLErrorCode::InvalidValueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE(insert_into_table_multiple_tuples_wrong_data_types)
|
||||||
|
{
|
||||||
|
ScopeGuard guard([]() { unlink(db_name); });
|
||||||
|
auto database = SQL::Database::construct(db_name);
|
||||||
|
create_table(database);
|
||||||
|
auto result = execute(database, "INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ('Test_1', 42), (43, 'Test_2');");
|
||||||
|
EXPECT(result->inserted() == 0);
|
||||||
|
EXPECT(result->error().code == SQL::SQLErrorCode::InvalidValueType);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE(select_from_table)
|
TEST_CASE(select_from_table)
|
||||||
{
|
{
|
||||||
ScopeGuard guard([]() { unlink(db_name); });
|
ScopeGuard guard([]() { unlink(db_name); });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue