Fix leafDataFromValue

Leafrefs were not working correctly, when pointing to a data node not in
the tree. Because of this I had to rework the thing a little bit (I
basically copied the algorithm from cla-sysrepo, where I had the same
issue). I also changed the name. And also added test, both versions of
leafref included.

Funnily enough, it seems that I was already fixing this before, but for
some reason the bug appeared again while using netconf-cli, oh well, now
the tests should cover that hopefully.

Change-Id: I8a102c54bf58a4221610c8a83d26979fb7b4461d
diff --git a/tests/pretty_printers.hpp b/tests/pretty_printers.hpp
index b459a11..d3d67d3 100644
--- a/tests/pretty_printers.hpp
+++ b/tests/pretty_printers.hpp
@@ -10,6 +10,11 @@
 #include "parser.hpp"
 #include "utils.hpp"
 namespace std {
+std::ostream& operator<<(std::ostream& s, const leaf_data_& value)
+{
+    s << "leaf_data_<"<< boost::core::demangle(value.type().name()) << ">{" << leafDataToString(value) << "}" << std::endl;
+    return s;
+}
 std::ostream& operator<<(std::ostream& s, const Completions& completion)
 {
     s << std::endl << "Completions {" << std::endl << "    m_completions: ";