Fix re-running aborted FS watcher test

If the test is interrupted and run again an assert is raised because the
temporary fswatcher_test dir has had no chance to be deleted and still
exists. Fix this by removing the dir before each test.
This commit is contained in:
Roberto Perpuly 2015-06-05 22:18:21 +04:00 committed by Dimitri Schoolwerth
parent ccd98c6ad9
commit bb14d8e131

View File

@ -476,6 +476,14 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FileSystemWatcherTestCase,
void FileSystemWatcherTestCase::setUp()
{
wxLog::AddTraceMask(wxTRACE_FSWATCHER);
// Before each test, remove the dir if it exists.
// It would exist if the previous test run was aborted.
wxString tmp = wxStandardPaths::Get().GetTempDir();
wxFileName dir;
dir.AssignDir(tmp);
dir.AppendDir("fswatcher_test");
dir.Rmdir(wxPATH_RMDIR_RECURSIVE);
EventGenerator::Get().GetWatchDir();
}