Change syntax for multi-key list indexing
List instances are now dereferenced by listing each key-value in
separate brackets. Value can be enclosed either in single quotes or in
double quotes.
Change-Id: Iad72b1002d4655249ecd7bfc7109814b45c7b16b
diff --git a/tests/cd.cpp b/tests/cd.cpp
index 5bf0172..bcc1dab 100644
--- a/tests/cd.cpp
+++ b/tests/cd.cpp
@@ -96,9 +96,9 @@
expected.m_path.m_nodes.push_back(node_(container_("contInList")));
}
- SECTION("example:twoKeyList[number=4 name=abcd]")
+ SECTION("example:twoKeyList[number=4][name='abcd']")
{
- input = "cd example:twoKeyList[number=4 name=abcd]";
+ input = "cd example:twoKeyList[number=4][name='abcd']";
auto keys = std::map<std::string, std::string>{
{"number", "4"},
{"name", "abcd"}};
@@ -250,25 +250,30 @@
input = "cd example:list[]";
}
- SECTION("example:twoKeyList[invalidKey=4]")
+ SECTION("example:twoKeyList[invalidKey='4']")
{
- input = "cd example:twoKeyList[invalidKey=4]";
+ input = "cd example:twoKeyList[invalidKey='4']";
}
- SECTION("example:twoKeyList[number=4 number=5]")
+ SECTION("example:twoKeyList[number=4][number=5]")
{
- input = "cd example:twoKeyList[number=4 number=5]";
+ input = "cd example:twoKeyList[number=4][number=5]";
}
- SECTION("example:twoKeyList[number=4 name=lol number=7]")
+ SECTION("example:twoKeyList[number=4][name='lol'][number=7]")
{
- input = "cd example:twoKeyList[number=4 name=lol number=7]";
+ input = "cd example:twoKeyList[number=4][name='lol'][number=7]";
}
SECTION("example:twoKeyList[number=4]")
{
input = "cd example:twoKeyList[number=4]";
}
+
+ SECTION("strings must be quoted")
+ {
+ input = "cd example:twoKeyList[number=4][name=abcd]";
+ }
}
REQUIRE_THROWS(parser.parseCommand(input, errorStream));
}
diff --git a/tests/presence_containers.cpp b/tests/presence_containers.cpp
index 9683daf..20e1d48 100644
--- a/tests/presence_containers.cpp
+++ b/tests/presence_containers.cpp
@@ -49,9 +49,9 @@
expectedPath.m_nodes = {{{module_{"mod"}}, container_("a")}, {container_("a2")}, {container_("a3")}};
}
- SECTION("mod:list[quote=lol]/contInList")
+ SECTION("mod:list[quote='lol']/contInList")
{
- input = "mod:list[quote=lol]/contInList";
+ input = "mod:list[quote='lol']/contInList";
auto keys = std::map<std::string, std::string>{
{"quote", "lol"}};
expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
@@ -83,9 +83,9 @@
input = "a/a2";
}
- SECTION("list[quote=lol]")
+ SECTION("list[quote='lol']")
{
- input = "list[quote=lol]";
+ input = "list[quote='lol']";
}
REQUIRE_THROWS(parser.parseCommand("create " + input, errorStream));