diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-24 14:25:59 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-31 15:21:02 +0200 |
commit | 052c762d16885b198989e2de164d37f8a8d19462 (patch) | |
tree | 7aa7e5b0d844192a5370acafe45543814483e2ae /test/buildtool/file_system/directory_entries.test.cpp | |
parent | a563be278f9ef4b928701e6c708726ba6252a213 (diff) | |
download | justbuild-052c762d16885b198989e2de164d37f8a8d19462.tar.gz |
test: Extend filesystem tests to git repos with symlinks...
...using the new ignore-special tree variant.
Diffstat (limited to 'test/buildtool/file_system/directory_entries.test.cpp')
-rw-r--r-- | test/buildtool/file_system/directory_entries.test.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/buildtool/file_system/directory_entries.test.cpp b/test/buildtool/file_system/directory_entries.test.cpp index 4ef550f8..8109db61 100644 --- a/test/buildtool/file_system/directory_entries.test.cpp +++ b/test/buildtool/file_system/directory_entries.test.cpp @@ -26,6 +26,9 @@ namespace { auto const kBundlePath = std::string{"test/buildtool/file_system/data/test_repo.bundle"}; +auto const kBundleSymPath = + std::string{"test/buildtool/file_system/data/test_repo_symlinks.bundle"}; + [[nodiscard]] auto GetTestDir() -> std::filesystem::path { auto* tmp_dir = std::getenv("TEST_TMPDIR"); if (tmp_dir != nullptr) { @@ -71,19 +74,24 @@ auto const kBundlePath = TEST_CASE("Get entries of a directory", "[directory_entries]") { const std::unordered_set<std::string> reference_entries{ - "test_repo.bundle", "empty_executable", "subdir", "example_file"}; + "test_repo.bundle", + "test_repo_symlinks.bundle", + "empty_executable", + "subdir", + "example_file"}; const auto dir = std::filesystem::path("test/buildtool/file_system/data"); auto fs_root = FileRoot(); auto dir_entries = fs_root.ReadDirectory(dir); CHECK(dir_entries.ContainsFile("test_repo.bundle")); + CHECK(dir_entries.ContainsFile("test_repo_symlinks.bundle")); CHECK(dir_entries.ContainsFile("empty_executable")); CHECK(dir_entries.ContainsFile("example_file")); { // all the entries returned by FilesIterator are files, // are contained in reference_entries, - // and are 3 + // and are 4 auto counter = 0; for (const auto& x : dir_entries.FilesIterator()) { REQUIRE(reference_entries.contains(x)); @@ -91,7 +99,7 @@ TEST_CASE("Get entries of a directory", "[directory_entries]") { ++counter; } - CHECK(counter == 3); + CHECK(counter == 4); } { // all the entries returned by DirectoriesIterator are not files (e.g., |