diff --git a/AK/Tests/TestJSON.cpp b/AK/Tests/TestJSON.cpp index 87dca328794..06a0fd0f621 100644 --- a/AK/Tests/TestJSON.cpp +++ b/AK/Tests/TestJSON.cpp @@ -100,12 +100,22 @@ TEST_CASE(json_empty_string) EXPECT_EQ(json.as_string().is_empty(), true); } -TEST_CASE(json_utf8_character) +TEST_CASE(json_string) { - auto json = JsonValue::from_string("\"\xc3\x84\"").value(); + auto json = JsonValue::from_string("\"A\"").value(); 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().length(), size_t { 1 }); + EXPECT_EQ(json.as_string() == "A", true); +} + +TEST_CASE(json_utf8_character) +{ + auto json = JsonValue::from_string("\"\\u0041\"").value(); + 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); } TEST_MAIN(JSON)