ls: Add test for container inside a list
The first path fragment gets parsed as a data node, but the second
can't. That means the parser has to backtrack and try to parse the path
as a schema path. A later patch had a problem where ParserContext path
wasn't getting properly reset. The actual problem happened in the
describe command, but they take the same type of paths.
Change-Id: Id62884d303c0a97051c78a80144f5f877821af2f
diff --git a/tests/ls.cpp b/tests/ls.cpp
index f862309..93ec75b 100644
--- a/tests/ls.cpp
+++ b/tests/ls.cpp
@@ -18,6 +18,7 @@
schema->addModule("second");
schema->addContainer("/", "example:a");
schema->addList("/example:a", "example:listInCont", {"number"});
+ schema->addContainer("/example:a/example:listInCont", "example:contInList");
schema->addContainer("/", "second:a");
schema->addContainer("/", "example:b");
schema->addContainer("/example:a", "example:a2");
@@ -153,6 +154,14 @@
dataNode_(module_{"example"}, list_{"listInCont"})}};
}
+ SECTION("ls example:a/example:listInCont/example:contInList")
+ {
+ input = "ls example:a/example:listInCont/example:contInList";
+ expected.m_path = schemaPath_{Scope::Relative, {schemaNode_(module_{"example"}, container_{"a"}),
+ schemaNode_(module_{"example"}, list_{"listInCont"}),
+ schemaNode_(module_{"example"}, container_{"contInList"})}};
+ }
+
SECTION("ls example:list[number=342]/contInList")
{
input = "ls example:list[number=342]/contInList";