Add support for yang type descriptions
Change-Id: I1fd070fb975aa82b2d4c1aa4165c5ab0153ff49f
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 1ec6507..699a05c 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -171,6 +171,7 @@
enum lol;
enum data;
}
+ description "This is a restricted enum typedef.";
}
leaf leafEnumTypedef {
@@ -518,6 +519,7 @@
SECTION("leafType")
{
yang::LeafDataType type;
+ std::optional<std::string> expectedDescription;
SECTION("leafString")
{
@@ -622,6 +624,7 @@
node.first = "example-schema";
node.second = "leafEnumTypedefRestricted2";
type = createEnum({"lol", "data"});
+ expectedDescription = "This is a restricted enum typedef.";
}
SECTION("pizzaSize")
@@ -736,7 +739,7 @@
}
- REQUIRE(ys.leafType(path, node) == type);
+ REQUIRE(ys.leafType(path, node) == yang::TypeInfo(type, std::nullopt, expectedDescription));
}
SECTION("availableNodes")
{
@@ -1072,6 +1075,16 @@
REQUIRE(ys.leafType(pathToSchemaString(path, Prefixes::WhenNeeded)) == yang::TypeInfo{expectedType, expectedUnits});
}
+ SECTION("type description")
+ {
+ yang::LeafDataType expectedType = createEnum({"lol", "data"});
+ std::optional<std::string> expectedDescription;
+
+ path.m_nodes.emplace_back(module_{"example-schema"}, leaf_("leafEnumTypedefRestricted2"));
+ expectedDescription = "This is a restricted enum typedef.";
+ REQUIRE(ys.leafType(pathToSchemaString(path, Prefixes::WhenNeeded)) == yang::TypeInfo{expectedType, std::nullopt, expectedDescription});
+ }
+
SECTION("nodeType")
{
yang::NodeTypes expected;