Add support for leafrefs
Change-Id: I2286aaa96abd960d13bb0b04a778fb264b2f74a4
diff --git a/tests/leaf_editing.cpp b/tests/leaf_editing.cpp
index b0db594..bcf06aa 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -48,6 +48,8 @@
schema->addLeaf("mod:contA", "mod:leafInCont", yang::LeafDataTypes::String);
schema->addList("", "mod:list", {"number"});
schema->addLeaf("mod:list", "mod:leafInList", yang::LeafDataTypes::String);
+ schema->addLeafRef("", "mod:refToString", "mod:leafString");
+ schema->addLeafRef("", "mod:refToInt8", "mod:leafInt8");
Parser parser(schema);
std::string input;
std::ostringstream errorStream;
@@ -271,6 +273,22 @@
}
}
}
+ SECTION("leafRef")
+ {
+ SECTION("refToString")
+ {
+ input = "set mod:refToString blabal";
+ expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, leaf_("refToString")});
+ expected.m_data = std::string("blabal");
+ }
+
+ SECTION("refToInt8")
+ {
+ input = "set mod:refToInt8 42";
+ expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, leaf_("refToInt8")});
+ expected.m_data = int8_t{42};
+ }
+ }
}
command_ command = parser.parseCommand(input, errorStream);
@@ -359,6 +377,10 @@
{
input = "set leafEnum blabla";
}
+ SECTION("set mod:refToInt8 blabla")
+ {
+ input = "set mod:refToInt8 blabla";
+ }
}
SECTION("wrong base64 strings")