tests: leaf editing: allow `cd` before `set`

...because the next commit will add support for instance-identifier
which manipulates data paths.

Change-Id: Id2c65cec7e25e0a2e309712fc9f682907e838d8e
diff --git a/tests/leaf_editing.cpp b/tests/leaf_editing.cpp
index 40ce08d..5965110 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -80,6 +80,7 @@
     SECTION("valid input")
     {
         set_ expected;
+        dataPath_ cwd;
 
         SECTION("set mod:leafString \"some_data\"")
         {
@@ -88,6 +89,14 @@
             expected.m_data = std::string("some_data");
         }
 
+        SECTION("cd mod:contA; set leafInCont 'x'")
+        {
+            input = "set leafInCont 'x'";
+            cwd.m_nodes.emplace_back(module_{"mod"}, container_{"contA"});
+            expected.m_path.m_nodes.emplace_back(leaf_("leafInCont"));
+            expected.m_data = std::string("x");
+        }
+
         SECTION("set mod:contA/leafInCont 'more_data'")
         {
             input = "set mod:contA/leafInCont 'more_data'";
@@ -500,6 +509,7 @@
             }
         }
 
+        parser.changeNode(cwd);
         command_ command = parser.parseCommand(input, errorStream);
         REQUIRE(command.type() == typeid(set_));
         REQUIRE(boost::get<set_>(command) == expected);
@@ -508,6 +518,8 @@
     SECTION("invalid input")
     {
         std::string expectedError;
+        dataPath_ cwd;
+
         SECTION("missing space between a command and its arguments")
         {
             SECTION("setmod:leafString some_data")
@@ -671,6 +683,7 @@
             input = "set mod:flags carry carry";
         }
 
+        parser.changeNode(cwd);
         REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
         REQUIRE(errorStream.str().find(expectedError) != std::string::npos);
     }