Fix StaticSchema::lastNodeOfSchemaPath
This if branch was never used in any test, so the bug never came up.
Change-Id: I785600076df8aea7d8169b020d0bda65f5b74ae4
diff --git a/tests/leaf_editing.cpp b/tests/leaf_editing.cpp
index ca720c5..9ce5c35 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -52,6 +52,7 @@
schema->addLeaf("/mod:list", "mod:leafInList", yang::String{});
schema->addLeaf("/", "mod:refToString", yang::LeafRef{"/mod:leafString", std::make_unique<yang::LeafDataType>(schema->leafType("/mod:leafString"))});
schema->addLeaf("/", "mod:refToInt8", yang::LeafRef{"/mod:leafInt8", std::make_unique<yang::LeafDataType>(schema->leafType("/mod:leafInt8"))});
+ schema->addLeaf("/", "mod:refToLeafInCont", yang::LeafRef{"/mod:contA/identInCont", std::make_unique<yang::LeafDataType>(schema->leafType("/mod:contA/mod:identInCont"))});
Parser parser(schema);
std::string input;
std::ostringstream errorStream;
@@ -314,6 +315,13 @@
expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, leaf_("refToInt8")});
expected.m_data = int8_t{42};
}
+
+ SECTION("refToLeafInCont")
+ {
+ input = "set mod:refToLeafInCont pizza";
+ expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, leaf_("refToLeafInCont")});
+ expected.m_data = identityRef_{"pizza"};
+ }
}
}