Skip to content

Commit 4515087

Browse files
Vipul-Cariappavgvassilev
authored andcommitted
fix DestructArray test
makes valgrind happy, as the call to new and delete now match
1 parent 0b1271a commit 4515087

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,17 +2681,18 @@ TEST(FunctionReflectionTest, DestructArray) {
26812681
output.clear();
26822682

26832683
// deallocate since we call the destructor withFree = false
2684-
Cpp::Deallocate(scope, where, 5);
2684+
Cpp::Deallocate(scope, where, a);
26852685

26862686
// perform the same withFree=true
2687-
where = Cpp::Allocate(scope, a);
2688-
EXPECT_TRUE(where == Cpp::Construct(scope, where, a));
2687+
where = nullptr;
2688+
where = Cpp::Construct(scope, nullptr, a);
2689+
EXPECT_TRUE(where);
26892690
testing::internal::CaptureStdout();
2690-
// FIXME : This should work with the array of objects as well
2691-
// Cpp::Destruct(where, scope, true, 5);
2692-
EXPECT_TRUE(Cpp::Destruct(where, scope, true));
2691+
EXPECT_TRUE(Cpp::Destruct(where, scope, true, a));
26932692
output = testing::internal::GetCapturedStdout();
2694-
EXPECT_EQ(output, "\nDestructor Executed\n");
2693+
EXPECT_EQ(output,
2694+
"\nDestructor Executed\n\nDestructor Executed\n\nDestructor "
2695+
"Executed\n\nDestructor Executed\n\nDestructor Executed\n");
26952696
output.clear();
26962697
}
26972698

0 commit comments

Comments
 (0)