parse json FEATURE support empty lists
Refs #1822
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index a9c537f..4682dcf 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -172,6 +172,11 @@
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
+ /* accept empty */
+ data = "{\"a:ll1\":[]}";
+ CHECK_PARSE_LYD(data, 0, LYD_VALIDATE_PRESENT, tree);
+ assert_null(tree);
+
/* simple metadata */
data = "{\"a:ll1\":[10,11],\"@a:ll1\":[null,{\"a:hint\":2}]}";
CHECK_PARSE_LYD(data, 0, LYD_VALIDATE_PRESENT, tree);
@@ -368,10 +373,14 @@
LY_LIST_FOR(list->child, iter) {
assert_int_not_equal(0, iter->hash);
}
-
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
+ /* accept empty */
+ data = "{\"a:l1\":[]}";
+ CHECK_PARSE_LYD(data, 0, LYD_VALIDATE_PRESENT, tree);
+ assert_null(tree);
+
/* missing keys */
PARSER_CHECK_ERROR("{ \"a:l1\": [ {\"c\" : 1, \"b\" : \"b\"}]}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
"List instance is missing its key \"a\".", "Schema location /a:l1, data location /a:l1[b='b'][c='1'], line number 1.");