On Thu, 07.05.15 17:47, Pavel Odvody (podv...@redhat.com) wrote: > 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}"); > +
Any chance you can extend the test to check the structure of the of the object parsed for validity here? Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel