Skip to content

Commit

Permalink
TestSuite: Don't leak the suite instance
Browse files Browse the repository at this point in the history
Makes checking for leaks more straightforward
  • Loading branch information
rburchell authored and awesomekling committed Jul 21, 2019
1 parent fc479d1 commit a9db382
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions AK/TestSuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ class TestSuite {
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);
Expand Down Expand Up @@ -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) \
Expand Down

0 comments on commit a9db382

Please sign in to comment.