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));
}