Fix toCanonical going up from root
This is like a third place where I'm adding this .empty() check, I
should probably make a function that does this for me.
Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/178
Change-Id: Iafc43df1d8fc882a1b27b9ce1c6c5ce663800e41
diff --git a/tests/interpreter.cpp b/tests/interpreter.cpp
index b296ca1..3acef2b 100644
--- a/tests/interpreter.cpp
+++ b/tests/interpreter.cpp
@@ -54,6 +54,26 @@
expectedPath = dataPath_{};
}
+ SECTION("arg: ..")
+ {
+ lsArg = dataPath_{Scope::Relative, {dataNode_{nodeup_{}}}};
+ expectedPath = dataPath_{};
+ }
+
+ SECTION("arg: /..")
+ {
+ lsArg = dataPath_{Scope::Absolute, {dataNode_{nodeup_{}}}};
+ expectedPath = dataPath_{Scope::Absolute, {}};
+ }
+
+ SECTION("arg: /example:a/../example:a")
+ {
+ lsArg = dataPath_{Scope::Absolute, {{module_{"example"}, container_{"a"}},
+ {nodeup_{}},
+ {module_{"example"}, container_{"a"}}}};
+ expectedPath = dataPath_{Scope::Absolute, {{module_{"example"}, container_{"a"}}}};
+ }
+
SECTION("arg: example:a")
{
lsArg = dataPath_{Scope::Relative, {{module_{"example"}, container_{"a"}}}};