Rework Schema::units into Schema::leafType

Change-Id: I9c1f039e7e054f84559a3d57812d0254db183a99
diff --git a/tests/pretty_printers.hpp b/tests/pretty_printers.hpp
index e5b6659..98638ea 100644
--- a/tests/pretty_printers.hpp
+++ b/tests/pretty_printers.hpp
@@ -64,14 +64,22 @@
         s << "}";
     }
     if (std::holds_alternative<yang::LeafRef>(type)) {
-        s << "{" << std::get<yang::LeafRef>(type).m_targetXPath << "," << *std::get<yang::LeafRef>(type).m_targetType  << "}";
+        s << "{" << std::get<yang::LeafRef>(type).m_targetXPath << "," << std::get<yang::LeafRef>(type).m_targetType->m_type  << "}";
     }
     if (std::holds_alternative<yang::Union>(type)) {
         s << "{" << std::endl;
         auto types = std::get<yang::Union>(type).m_unionTypes;
-        std::copy(types.begin(), types.end(), std::experimental::make_ostream_joiner(s, ",\n"));
+        std::transform(types.begin(), types.end(), std::experimental::make_ostream_joiner(s, ",\n"), [] (const auto& type) {
+            return type.m_type;
+        });
     }
     s << std::endl;
     return s;
 }
+
+std::ostream& operator<<(std::ostream& s, const yang::TypeInfo& type)
+{
+    s << type.m_type << (type.m_units ? " units: " + *type.m_units : "");
+    return s;
+}
 }