allow moving up a node with cd
Change-Id: Id1419fddda4aa2d2c16b5775a43c8df58db98c73
diff --git a/tests/cd.cpp b/tests/cd.cpp
index d6079fb..8ab4c40 100644
--- a/tests/cd.cpp
+++ b/tests/cd.cpp
@@ -101,6 +101,33 @@
}
}
+ SECTION("moving up")
+ {
+ SECTION("a/..")
+ {
+ input = "cd a/..";
+ expected.m_path.m_nodes.push_back(container_("a"));
+ expected.m_path.m_nodes.push_back(nodeup_());
+ }
+
+ SECTION("a/../a")
+ {
+ input = "cd a/../a";
+ expected.m_path.m_nodes.push_back(container_("a"));
+ expected.m_path.m_nodes.push_back(nodeup_());
+ expected.m_path.m_nodes.push_back(container_("a"));
+ }
+
+ SECTION("a/../a/a2")
+ {
+ input = "cd a/../a/a2";
+ expected.m_path.m_nodes.push_back(container_("a"));
+ expected.m_path.m_nodes.push_back(nodeup_());
+ expected.m_path.m_nodes.push_back(container_("a"));
+ expected.m_path.m_nodes.push_back(container_("a2"));
+ }
+ }
+
cd_ command = parser.parseCommand(input, errorStream);
REQUIRE(command == expected);
}