nfprojects / nfengine

Game engine
GNU General Public License v2.0
55 stars 4 forks source link

Add automatic resource cleanup to FileSystem and File tests #131

Open lookeypl opened 9 years ago

lookeypl commented 9 years ago

Some tests related to FileSystem and File (ex. FileSystemTest::TouchFile) create a file during the test. In case of failure, the file will stay and future test calls will fail earlier because the test file already exists. Investigate all possible places where such thing might happen and implement a solution to fix it. Probably a FileRAII might be a good idea here - see what will be the best for these tests.

Witek902 commented 9 years ago

Maybe just put all test files in some "TestData" folder and modify python script so it's always removed after running the tests?

lookeypl commented 9 years ago

This should be done by tests themself, not by the test script. Someone can call "Bin/x64/Release/nfCommonTest.exe" directly (I do that sometimes) and then nothing will remove the files.

mkulagowski commented 9 years ago

Can't You put them into folder and overload gtest's TearDown() to delete the folder recursively, if it exists?

lookeypl commented 9 years ago

@mkulagowski it is one of the solutions. Assignee will have to do the investigation and choose what is best for our tests. ;)