Skip to content

Commit

Permalink
Delete the MD5 database before unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Nov 14, 2020
1 parent 25d501f commit 6c0b595
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

TEST_CASE("Md5DatabaseSqlite")
{
FileDeleter settingsDeleter("tests/resources/md5s.sqlite");
FileDeleter settingsDeleter("tests/resources/md5s.sqlite", true);

QSettings settings("tests/resources/settings.ini", QSettings::IniFormat);
{
Expand Down
8 changes: 6 additions & 2 deletions src/tests/src/raii-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
class FileDeleter
{
public:
explicit FileDeleter(QString path)
explicit FileDeleter(QString path, bool del = false)
: m_path(std::move(path))
{}
{
if (del && QFile::exists(m_path)) {
QFile::remove(m_path);
}
}

~FileDeleter()
{
Expand Down

0 comments on commit 6c0b595

Please sign in to comment.