mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
AK: Add test case for duplicate JsonObject keys
This commit is contained in:
parent
f649009887
commit
62ea2c5437
Notes:
sideshowbarker
2024-07-19 04:04:10 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/62ea2c54376 Pull-request: https://github.com/SerenityOS/serenity/pull/3070 Issue: https://github.com/SerenityOS/serenity/issues/3069 Reviewed-by: https://github.com/awesomekling
1 changed files with 13 additions and 4 deletions
|
@ -106,7 +106,7 @@ TEST_CASE(json_string)
|
|||
EXPECT_EQ(json.type(), JsonValue::Type::String);
|
||||
EXPECT_EQ(json.as_string().is_null(), false);
|
||||
EXPECT_EQ(json.as_string().length(), size_t { 1 });
|
||||
EXPECT_EQ(json.as_string() == "A", true);
|
||||
EXPECT_EQ(json.as_string() == "A", true);
|
||||
}
|
||||
|
||||
TEST_CASE(json_utf8_character)
|
||||
|
@ -115,7 +115,7 @@ TEST_CASE(json_utf8_character)
|
|||
EXPECT_EQ(json.type(), JsonValue::Type::String);
|
||||
EXPECT_EQ(json.as_string().is_null(), false);
|
||||
EXPECT_EQ(json.as_string().length(), size_t { 1 });
|
||||
EXPECT_EQ(json.as_string() == "A", true);
|
||||
EXPECT_EQ(json.as_string() == "A", true);
|
||||
}
|
||||
|
||||
TEST_CASE(json_utf8_multibyte)
|
||||
|
@ -124,8 +124,8 @@ TEST_CASE(json_utf8_multibyte)
|
|||
EXPECT_EQ(json.type(), JsonValue::Type::String);
|
||||
EXPECT_EQ(json.as_string().is_null(), false);
|
||||
EXPECT_EQ(json.as_string().length(), size_t { 2 });
|
||||
EXPECT_EQ(json.as_string() == "š", true);
|
||||
EXPECT_EQ(json.as_string() == "\xc5\xa1", true);
|
||||
EXPECT_EQ(json.as_string() == "š", true);
|
||||
EXPECT_EQ(json.as_string() == "\xc5\xa1", true);
|
||||
}
|
||||
|
||||
TEST_CASE(json_64_bit_value)
|
||||
|
@ -136,4 +136,13 @@ TEST_CASE(json_64_bit_value)
|
|||
EXPECT_EQ(big_json_value.as_u64(), big_json_value_copy.as_u64());
|
||||
}
|
||||
|
||||
TEST_CASE(json_duplicate_keys)
|
||||
{
|
||||
JsonObject json;
|
||||
json.set("test", "foo");
|
||||
json.set("test", "bar");
|
||||
json.set("test", "baz");
|
||||
EXPECT_EQ(json.to_string(), "{\"test\":\"baz\"}");
|
||||
}
|
||||
|
||||
TEST_MAIN(JSON)
|
||||
|
|
Loading…
Reference in a new issue