summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2021-04-21 12:21:41 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2021-04-23 12:25:40 +0200
commitb5211b9b213273c642a790ae3c3f3bbe1a4cf51e (patch)
tree64004aed27d7b5a4618aee12ed9b7df608ca343b /test
parent09e3c0c855e339216784a1d43715c3ae2d79ec23 (diff)
json: Encode NULL strings as null
This is the only nullable thing we have here.
Diffstat (limited to 'test')
-rw-r--r--test/libapt/json_test.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/libapt/json_test.cc b/test/libapt/json_test.cc
index 9c29936f6..ee8f3cebe 100644
--- a/test/libapt/json_test.cc
+++ b/test/libapt/json_test.cc
@@ -59,3 +59,11 @@ TEST(JsonTest, JsonStackRegression)
EXPECT_EQ("{\"a\":[{}],\"b\":[{}]}", os.str());
}
+TEST(JsonTest, JsonNull)
+{
+ std::ostringstream os;
+
+ JsonWriter(os).value(nullptr);
+
+ EXPECT_EQ("null", os.str());
+}