Allow data path to end with a list for get and ls

Change-Id: I3facc8315fa6192da4318012a85121de37e7314b
diff --git a/tests/ls.cpp b/tests/ls.cpp
index d202a1c..e42152d 100644
--- a/tests/ls.cpp
+++ b/tests/ls.cpp
@@ -17,6 +17,7 @@
     schema->addModule("example");
     schema->addModule("second");
     schema->addContainer("", "example:a");
+    schema->addList("example:a", "example:listInCont", {"number"});
     schema->addContainer("", "second:a");
     schema->addContainer("", "example:b");
     schema->addContainer("example:a", "example:a2");
@@ -127,6 +128,28 @@
                 expected.m_options.push_back(LsOption::Recursive);
                 expected.m_path = dataPath_{Scope::Absolute, {dataNode_(module_{"example"}, container_{"a"})}};
             }
+
+            SECTION("ls example:list")
+            {
+                input = "ls example:list";
+                expected.m_path = dataPath_{Scope::Relative, {dataNode_(module_{"example"}, list_{"list"})}};
+            }
+
+            SECTION("ls example:a/example:listInCont")
+            {
+                input = "ls example:a/example:listInCont";
+                expected.m_path = dataPath_{Scope::Relative, {dataNode_(module_{"example"}, container_{"a"}),
+                                                                dataNode_(module_{"example"}, list_{"listInCont"})}};
+            }
+
+            SECTION("ls example:list[number=342]/contInList")
+            {
+                input = "ls example:list[number=342]/contInList";
+                auto keys = std::map<std::string, std::string>{
+                    {"number", "342"}};
+                expected.m_path = dataPath_{Scope::Relative, {dataNode_(module_{"example"}, listElement_{"list", keys}),
+                                                                dataNode_(container_{"contInList"})}};
+            }
         }
 
         command_ command = parser.parseCommand(input, errorStream);