From a9db382f0eb53b540745e4905c56281352390d40 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 21 Jul 2019 11:49:19 +0200 Subject: [PATCH] TestSuite: Don't leak the suite instance Makes checking for leaks more straightforward --- AK/TestSuite.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AK/TestSuite.h b/AK/TestSuite.h index 14be03cb3f..785669055e 100644 --- a/AK/TestSuite.h +++ b/AK/TestSuite.h @@ -79,6 +79,13 @@ public: s_global = new TestSuite(); return *s_global; } + + static void release() + { + delete s_global; + s_global = nullptr; + } + void run(const NonnullRefPtrVector& tests); void main(const String& suite_name, int argc, char** argv); NonnullRefPtrVector find_cases(const String& search, bool find_tests, bool find_benchmarks); @@ -225,6 +232,7 @@ using AK::TestSuite; { \ static_assert(compiletime_lenof(___str(SuiteName)) != 0, "Set SuiteName"); \ TestSuite::the().main(___str(SuiteName), argc, argv); \ + TestSuite::release(); \ } #define assertEqual(one, two) \