From 495a3884c89aec21031b810599fe163aa1bce319 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 18 Dec 2020 18:04:24 +0000 Subject: Fix memory of units in test case --- icespider/unittests/testCompile.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/icespider/unittests/testCompile.cpp b/icespider/unittests/testCompile.cpp index 811de52..fa16de3 100644 --- a/icespider/unittests/testCompile.cpp +++ b/icespider/unittests/testCompile.cpp @@ -41,8 +41,10 @@ BOOST_AUTO_TEST_CASE(testLoadConfiguration) Compile::RouteCompiler rc; rc.searchPath.push_back(rootDir); auto cfg = rc.loadConfiguration(rootDir / "testRoutes.json"); - auto u = rc.loadUnits(cfg); - rc.applyDefaults(cfg, u); + BOOST_REQUIRE(cfg); + auto units = rc.loadUnits(cfg); + BOOST_REQUIRE(!units.empty()); + rc.applyDefaults(cfg, units); BOOST_REQUIRE_EQUAL("common", cfg->name); BOOST_REQUIRE_EQUAL(13, cfg->routes.size()); @@ -69,6 +71,10 @@ BOOST_AUTO_TEST_CASE(testLoadConfiguration) BOOST_REQUIRE_EQUAL(1, cfg->slices.size()); BOOST_REQUIRE_EQUAL("test-api.ice", cfg->slices[0]); + + for (auto & u : units) { + u.second->destroy(); + } } BOOST_AUTO_TEST_CASE(testRouteCompile) -- cgit v1.2.3