mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
AK+Everywhere: Convert JSON value serialization to String
This removes the use of StringBuilder::OutputType (which was ByteString, and only used by the JSON classes). And it removes the StringBuilder template parameter from the serialization methods; this was only ever used with StringBuilder, so a template is pretty overkill here.
This commit is contained in:
parent
2c03de60da
commit
fe2dff4944
Notes:
github-actions[bot]
2025-02-21 00:28:53 +00:00
Author: https://github.com/trflynn89
Commit: fe2dff4944
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3631
Reviewed-by: https://github.com/awesomekling ✅
15 changed files with 98 additions and 95 deletions
|
@ -160,13 +160,13 @@ TEST_CASE(json_duplicate_keys)
|
|||
json.set("test"sv, "foo"sv);
|
||||
json.set("test"sv, "bar"sv);
|
||||
json.set("test"sv, "baz"sv);
|
||||
EXPECT_EQ(json.serialized<StringBuilder>(), "{\"test\":\"baz\"}");
|
||||
EXPECT_EQ(json.serialized(), "{\"test\":\"baz\"}");
|
||||
}
|
||||
|
||||
TEST_CASE(json_u64_roundtrip)
|
||||
{
|
||||
auto big_value = 0xffffffffffffffffull;
|
||||
auto json = JsonValue(big_value).serialized<StringBuilder>();
|
||||
auto json = JsonValue(big_value).serialized();
|
||||
auto value = JsonValue::from_string(json);
|
||||
EXPECT_EQ_FORCE(value.is_error(), false);
|
||||
EXPECT_EQ(value.value().as_integer<u64>(), big_value);
|
||||
|
@ -531,7 +531,7 @@ TEST_CASE(json_array_serialized)
|
|||
auto raw_json = R"(["Hello",2,3.14,4,"World"])"sv;
|
||||
auto json_value = MUST(JsonValue::from_string(raw_json));
|
||||
auto array = json_value.as_array();
|
||||
auto const& serialized_json = array.serialized<StringBuilder>();
|
||||
auto const& serialized_json = array.serialized();
|
||||
EXPECT_EQ(serialized_json, raw_json);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue