Fix pathToDataString

The function wasn't properly converting multi-keyed lists. It also
didn't care if the path was absolute. This patch fixes both of these
issues.

Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/143
Change-Id: I4c3d19202be28e84b1db9a8311f49b848ef48a34
diff --git a/tests/path_utils.cpp b/tests/path_utils.cpp
new file mode 100644
index 0000000..eba2b34
--- /dev/null
+++ b/tests/path_utils.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 CESNET, https://photonics.cesnet.cz/
+ *
+ * Written by Václav Kubernát <kubervac@fit.cvut.cz>
+ *
+*/
+
+#include "trompeloeil_doctest.h"
+#include "ast_path.hpp"
+
+TEST_CASE("path utils")
+{
+    SECTION("pathToDataString")
+    {
+        dataPath_ path;
+        std::string expected;
+        SECTION("example-schema:twoKeyList[first='a'][second='b']")
+        {
+            SECTION("absolute")
+            {
+                path.m_scope = Scope::Absolute;
+                expected += "/";
+            }
+            SECTION("relative")
+            {
+                path.m_scope = Scope::Relative;
+            }
+            path.m_nodes.push_back(dataNode_{module_{"example-schema"}, listElement_{"twoKeyList", {{"first", "a"}, {"second", "b"}}}});
+            expected += "example-schema:twoKeyList[first='a'][second='b']";
+        }
+        REQUIRE(pathToDataString(path) == expected);
+    }
+}