tests: clear fs, imglib between tests
This commit is contained in:
parent
de1e130e4f
commit
887ba83151
|
|
@ -304,6 +304,7 @@ const texture *find(std::string_view str)
|
|||
|
||||
void clear()
|
||||
{
|
||||
palette.clear();
|
||||
textures.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,33 @@
|
|||
|
||||
#include <common/log.hh>
|
||||
#include <common/threads.hh>
|
||||
#include <common/fs.hh>
|
||||
#include <common/imglib.hh>
|
||||
|
||||
bool tests_verbose = false;
|
||||
|
||||
class clear_shared_data_listener : public testing::TestEventListener
|
||||
{
|
||||
public:
|
||||
void OnTestProgramStart(const testing::UnitTest &unit_test) override { }
|
||||
void OnTestIterationStart(const testing::UnitTest &unit_test, int iteration) override { }
|
||||
void OnEnvironmentsSetUpStart(const testing::UnitTest &unit_test) override { }
|
||||
void OnEnvironmentsSetUpEnd(const testing::UnitTest &unit_test) override { }
|
||||
void OnTestSuiteStart(const testing::TestSuite &test_suite) override { }
|
||||
void OnTestStart(const testing::TestInfo &test_info) override {
|
||||
fs::clear();
|
||||
img::clear();
|
||||
}
|
||||
void OnTestDisabled(const testing::TestInfo &test_info) override { }
|
||||
void OnTestPartResult(const testing::TestPartResult &test_part_result) override { }
|
||||
void OnTestEnd(const testing::TestInfo &test_info) override { }
|
||||
void OnTestSuiteEnd(const testing::TestSuite &test_suite) override { }
|
||||
void OnEnvironmentsTearDownStart(const testing::UnitTest &unit_test) override { }
|
||||
void OnEnvironmentsTearDownEnd(const testing::UnitTest &unit_test) override { }
|
||||
void OnTestIterationEnd(const testing::UnitTest &unit_test, int iteration) override { }
|
||||
void OnTestProgramEnd(const testing::UnitTest &unit_test) override { }
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
logging::preinitialize();
|
||||
|
|
@ -32,5 +56,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
// clear fs, etc., between each test
|
||||
testing::TestEventListeners &listeners = testing::UnitTest::GetInstance()->listeners();
|
||||
listeners.Append(new clear_shared_data_listener());
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue