Fix parsing of absolute list-ending paths
When parsing an absolute path, the grammar first clears m_curPath in
absolutePath_class, and then tries to parse nodes separated by slashes.
Due to how list-ending paths are a little bit more complex, these nodes
are parsed in a separate rule called dataNodesListEnd. This rule
incorrectly used initializePath to reset the m_curPath to the original
one (which basically means undoing what absolutePath_class does).
dataNodesListEnd doesn't reset the path anymore.
Change-Id: If617b697f37b25a15521cb947919c6ac9b6c81bd
diff --git a/tests/ls.cpp b/tests/ls.cpp
index e18cf25..fffac28 100644
--- a/tests/ls.cpp
+++ b/tests/ls.cpp
@@ -135,6 +135,14 @@
expected.m_path = dataPath_{Scope::Relative, {dataNode_(module_{"example"}, list_{"list"})}};
}
+ SECTION("ls /example:list")
+ {
+ SECTION("cwd: /") {}
+ SECTION("cwd: /example:a") { parser.changeNode(dataPath_{Scope::Relative, {dataNode_(module_{"example"}, container_{"a"})}}); }
+ input = "ls /example:list";
+ expected.m_path = dataPath_{Scope::Absolute, {dataNode_(module_{"example"}, list_{"list"})}};
+ }
+
SECTION("ls example:a/example:listInCont")
{
input = "ls example:a/example:listInCont";