summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
Diffstat (limited to 'AK')
-rw-r--r--AK/Tests/TestJSON.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/AK/Tests/TestJSON.cpp b/AK/Tests/TestJSON.cpp
index ba196e4cdb..90a4a58d21 100644
--- a/AK/Tests/TestJSON.cpp
+++ b/AK/Tests/TestJSON.cpp
@@ -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)