mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
AK: Add test case for duplicate JsonObject keys
This commit is contained in:
parent
f649009887
commit
62ea2c5437
|
@ -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