summaryrefslogtreecommitdiff
path: root/Tests/AK/TestJSON.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-16 21:52:20 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-16 22:48:17 +0100
commita409b832facf87b7623b5e649aec4ef4f6880161 (patch)
tree6a55af6c7a459ad79156b524a0fd020a8bb942a0 /Tests/AK/TestJSON.cpp
parentb38f8902d2e277e8cc8028add0eec946170854cd (diff)
downloadserenity-a409b832facf87b7623b5e649aec4ef4f6880161.zip
AK: Make JsonValue::from_string("") return a null JsonValue
This unbreaks the /var/run/utmp system which starts out as an empty string, and is then turned into an object by the first update. This isn't necessarily the best way for this to work, but it's how it used to work, so this just fixes the regression for now.
Diffstat (limited to 'Tests/AK/TestJSON.cpp')
-rw-r--r--Tests/AK/TestJSON.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/AK/TestJSON.cpp b/Tests/AK/TestJSON.cpp
index aa1f8139a9..7f0cbab296 100644
--- a/Tests/AK/TestJSON.cpp
+++ b/Tests/AK/TestJSON.cpp
@@ -122,3 +122,9 @@ TEST_CASE(json_u64_roundtrip)
EXPECT_EQ_FORCE(value.is_error(), false);
EXPECT_EQ(value.value().as_u64(), big_value);
}
+
+TEST_CASE(json_parse_empty_string)
+{
+ auto value = JsonValue::from_string("");
+ EXPECT_EQ(value.value().is_null(), true);
+}