diff --git a/tests/integration/Functions.cpp b/tests/integration/Functions.cpp index 98a44d5..37efbb4 100644 --- a/tests/integration/Functions.cpp +++ b/tests/integration/Functions.cpp @@ -44,8 +44,12 @@ TEST_CASE( "Define script function and call from extern", "[integration]" ) { script->Evaluate(); REQUIRE(script->HasFunction("add")); - script->CallFunction("add", {new IntegerEvalValue(5)}); - script->CallFunction("add", {new IntegerEvalValue(6)}); + auto toAddVal = new IntegerEvalValue(5); + script->CallFunction("add", {toAddVal}); + delete toAddVal; + toAddVal = new IntegerEvalValue(6); + script->CallFunction("add", {toAddVal}); + delete toAddVal; auto result = script->GetVariable("result"); REQUIRE(result->GetType()->GetClass() == TypeClass::Number);