From 24fb3c22de5345bd0de2323ced776c4168efac25 Mon Sep 17 00:00:00 2001 From: Vipul Cariappa Date: Mon, 15 Sep 2025 11:12:21 +0200 Subject: [PATCH] fix DestructArray test makes valgrind happy, as the call to new and delete now match --- unittests/CppInterOp/FunctionReflectionTest.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/unittests/CppInterOp/FunctionReflectionTest.cpp b/unittests/CppInterOp/FunctionReflectionTest.cpp index 1bd83e929..f568a054b 100644 --- a/unittests/CppInterOp/FunctionReflectionTest.cpp +++ b/unittests/CppInterOp/FunctionReflectionTest.cpp @@ -2681,17 +2681,18 @@ TEST(FunctionReflectionTest, DestructArray) { output.clear(); // deallocate since we call the destructor withFree = false - Cpp::Deallocate(scope, where, 5); + Cpp::Deallocate(scope, where, a); // perform the same withFree=true - where = Cpp::Allocate(scope, a); - EXPECT_TRUE(where == Cpp::Construct(scope, where, a)); + where = nullptr; + where = Cpp::Construct(scope, nullptr, a); + EXPECT_TRUE(where); testing::internal::CaptureStdout(); - // FIXME : This should work with the array of objects as well - // Cpp::Destruct(where, scope, true, 5); - EXPECT_TRUE(Cpp::Destruct(where, scope, true)); + EXPECT_TRUE(Cpp::Destruct(where, scope, true, a)); output = testing::internal::GetCapturedStdout(); - EXPECT_EQ(output, "\nDestructor Executed\n"); + EXPECT_EQ(output, + "\nDestructor Executed\n\nDestructor Executed\n\nDestructor " + "Executed\n\nDestructor Executed\n\nDestructor Executed\n"); output.clear(); }