Skip to content

Commit 2b3dec4

Browse files
authored
TestCmdlineParser: properly reset settings and parser between tests (cppcheck-opensource#5310)
1 parent 0901ba9 commit 2b3dec4

3 files changed

Lines changed: 628 additions & 642 deletions

File tree

test/fixture.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ bool TestFixture::prepareTest(const char testname[])
9191
mTemplateFormat.clear();
9292
mTemplateLocation.clear();
9393

94+
prepareTestInternal();
95+
9496
// Check if tests should be executed
9597
if (testToRun.empty() || testToRun == testname) {
9698
// Tests will be executed - prepare them

test/fixture.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class TestFixture : public ErrorLogger {
6060
virtual void run() = 0;
6161

6262
bool prepareTest(const char testname[]);
63+
virtual void prepareTestInternal() {}
6364
std::string getLocationStr(const char * const filename, const unsigned int linenr) const;
6465

6566
bool assert_(const char * const filename, const unsigned int linenr, const bool condition) const;

0 commit comments

Comments
 (0)