summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-07-21 11:49:19 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-21 11:51:10 +0200
commita9db382f0eb53b540745e4905c56281352390d40 (patch)
tree3d14f74e9c64b41366bf2c04e875de66780588cb
parentfc479d1e20f7810626f22f9c2acfae8632508a0e (diff)
downloadserenity-a9db382f0eb53b540745e4905c56281352390d40.zip
TestSuite: Don't leak the suite instance
Makes checking for leaks more straightforward
-rw-r--r--AK/TestSuite.h8
1 files changed, 8 insertions, 0 deletions
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<TestCase>& tests);
void main(const String& suite_name, int argc, char** argv);
NonnullRefPtrVector<TestCase> 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) \