Skip to content

Commit

Permalink
Fix fixtures for new tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jun 16, 2024
1 parent 022f600 commit 35ba1c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Empty file.
Empty file.
15 changes: 12 additions & 3 deletions test/usvfs_global_test_runner/usvfs_global_test_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ class usvfs_guard
class usvfs_test_runner
{
public:
usvfs_test_runner(std::wstring_view test_group)
: m_group{test_group}, m_temporary_folder{test::path_of_test_temp()}
usvfs_test_runner(std::wstring_view test_group, bool overwrite = true)
: m_group{test_group}, m_temporary_folder{test::path_of_test_temp()},
m_overwrite{overwrite}
{}
~usvfs_test_runner() { cleanup(); }

Expand Down Expand Up @@ -204,6 +205,9 @@ class usvfs_test_runner

// path to the folder containing temporary files
std::filesystem::path m_temporary_folder;

// use an overwrite folder or not
bool m_overwrite;
};

void usvfs_test_runner::cleanup() const
Expand All @@ -223,6 +227,11 @@ void usvfs_test_runner::prepare_filesystem() const
if (exists(fixtures)) {
copy(fixtures, m_temporary_folder, std::filesystem::copy_options::recursive);
}

const auto overwrite = m_temporary_folder / L"overwrite";
if (m_overwrite && !exists(overwrite)) {
create_directory(overwrite);
}
}

void usvfs_test_runner::prepare_mapping(const std::filesystem::path& data,
Expand Down Expand Up @@ -309,7 +318,7 @@ int usvfs_test_runner::run() const

TEST(BasicTest, Test)
{
ASSERT_EQ(0, usvfs_test_runner(L"BasicTest").run());
ASSERT_EQ(0, usvfs_test_runner(L"BasicTest", false).run());
}

TEST(RedFileSystemTest, Test)
Expand Down

0 comments on commit 35ba1c8

Please sign in to comment.