schema BUGFIX handle empty subtrees in lys_getnext()
correct moving through an empty multi-level subtree (of choices, cases
and non-presence containers).
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index c959a2e..a43d6fc 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -46,7 +46,7 @@
" anyxml seven; action eight {input {leaf eight-input {type string;}} output {leaf eight-output {type string;}}}"
" notification nine {leaf nine-data {type string;}}}"
"leaf b {type string;} leaf-list c {type string;} list d {config false;}"
- "choice x { case empty-x; leaf e {type string;} case y {leaf f {type string;}}} anyxml g;"
+ "choice x { case empty-x { choice empty-xc { case nothing;}} leaf e {type string;} case y {leaf f {type string;}}} anyxml g;"
"rpc h {input {leaf h-input {type string;}} output {leaf h-output {type string;}}}"
"rpc i;"
"notification j {leaf i-data {type string;}}"
@@ -142,6 +142,12 @@
assert_string_equal("d", node->name);
assert_null(node = lys_getnext(node, NULL, mod->compiled, LYS_GETNEXT_NOSTATECHECK));
+ assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {namespace urn:e;prefix e; container c {container cc;} leaf a {type string;}}", LYS_IN_YANG, &mod));
+ assert_non_null(node = lys_getnext(NULL, NULL, mod->compiled, 0));
+ assert_string_equal("c", node->name);
+ assert_non_null(node = lys_getnext(NULL, NULL, mod->compiled, LYS_GETNEXT_INTONPCONT));
+ assert_string_equal("a", node->name);
+
*state = NULL;
ly_ctx_destroy(ctx, NULL);
}