Skip to content

Commit

Permalink
Add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jun 22, 2024
1 parent 5337770 commit db45b83
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/usvfs_global_test/usvfs_global_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

#include "../usvfs_global_test_runner/gtest_utils.h"

// anonymous class that allow tests to access parameters (currently only where the
// virtualized data folder is)
//
class
{
bool initialize(int argc, char* argv[])
Expand Down Expand Up @@ -54,6 +57,8 @@ TEST(BasicTest, SimpleTest)
ASSERT_FALSE(exists(data / "info.txt"));
}

// see https://github.com/ModOrganizer2/modorganizer/issues/2039 for context
//
TEST(RedFileSystemTest, RedFileSystemTest)
{
const auto data = parameters.data();
Expand All @@ -63,9 +68,15 @@ TEST(RedFileSystemTest, RedFileSystemTest)

ASSERT_TRUE(exists(hudpainter_path / "DEFAULT.json"));

// TEST.json does not exist, so will be created in overwrite - this mainly check that
// weakly_canonical returns the path under data/ and not the actual path under
// overwrite/
//
// this relies on the hook for NtQueryInformationFile
//
ASSERT_FALSE(exists(hudpainter_path / "TEST.json"));
ASSERT_EQ(hudpainter_path / "TEST.json",
weakly_canonical(hudpainter_path / "TEST.json"));

write_content(hudpainter_path / "TEST.json", "{}");
}

Expand Down
7 changes: 7 additions & 0 deletions test/usvfs_global_test_runner/gtest_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ ::testing::AssertionResult AssertContentEquals(std::string_view expected,
const std::filesystem::path& path,
bool trim = true);

// macro to assert that the contents of two directories are identical - directories are
// compared recursively and file contents are compared (excluding extra spaces or lines
// in file)
//
#define ASSERT_DIRECTORY_EQ(Expected, Actual) \
ASSERT_TRUE(AssertDirectoryEquals(Expected, Actual))

// macro to assert that the contents of two files are identical (excluding extra space
// or lines in file)
//
#define ASSERT_CONTENT_EQ(Expected, Path) \
ASSERT_TRUE(AssertContentEquals(Expected, Path))

0 comments on commit db45b83

Please sign in to comment.