Change m_schema in Parser to a shared pointer
Shared pointers are reference counted, so this will prevent segmentation
faults in some cases.
Change-Id: Ie180cf6a639c8e73e70f395d19a6082b4fce73d4
diff --git a/tests/presence_containers.cpp b/tests/presence_containers.cpp
index 8958627..0a678fb 100644
--- a/tests/presence_containers.cpp
+++ b/tests/presence_containers.cpp
@@ -14,14 +14,14 @@
TEST_CASE("presence containers")
{
- Schema schema;
- schema.addContainer("", "a", yang::ContainerTraits::Presence);
- schema.addContainer("", "b");
- schema.addContainer("a", "a2");
- schema.addContainer("a/a2", "a3", yang::ContainerTraits::Presence);
- schema.addContainer("b", "b2", yang::ContainerTraits::Presence);
- schema.addList("", "list", {"quote"});
- schema.addContainer("list", "contInList", yang::ContainerTraits::Presence);
+ auto schema = std::make_shared<Schema>();
+ schema->addContainer("", "a", yang::ContainerTraits::Presence);
+ schema->addContainer("", "b");
+ schema->addContainer("a", "a2");
+ schema->addContainer("a/a2", "a3", yang::ContainerTraits::Presence);
+ schema->addContainer("b", "b2", yang::ContainerTraits::Presence);
+ schema->addList("", "list", {"quote"});
+ schema->addContainer("list", "contInList", yang::ContainerTraits::Presence);
Parser parser(schema);
std::string input;
std::ostringstream errorStream;