Signed-off-by: Pavel Odvody <podv...@redhat.com> --- src/test/test-json.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/src/test/test-json.c b/src/test/test-json.c index 24dc700..745eeb0 100644 --- a/src/test/test-json.c +++ b/src/test/test-json.c @@ -72,6 +72,17 @@ static void test_one(const char *data, ...) { va_end(ap); } +static void test_file(const char *data) { + json_variant *v = NULL; + int r = json_parse(data, &v); + + assert_se(r == 0); + assert_se(v != NULL); + assert_se(v->type == JSON_VARIANT_OBJECT); + + json_variant_unref(v); +} + int main(int argc, char *argv[]) { test_one("x", -EINVAL); @@ -102,5 +113,10 @@ int main(int argc, char *argv[]) { test_one("\"\\udc00\\udc00\"", -EINVAL); test_one("\"\\ud801\\udc37\"", JSON_STRING, "\xf0\x90\x90\xb7", JSON_END); + test_one("[1, 2]", JSON_ARRAY_OPEN, JSON_INTEGER, 1, JSON_COMMA, JSON_INTEGER, 2, JSON_ARRAY_CLOSE, JSON_END); + + test_file("{\"k\": \"v\", \"foo\": [1, 2, 3], \"bar\": {\"zap\": null}}"); + test_file("{\"mutant\": [1, null, \"1\", {\"1\": [1, \"1\"]}], \"blah\": 1.27}"); + return 0; } -- 2.1.0
signature.asc
Description: This is a digitally signed message part
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel