summaryrefslogtreecommitdiff
path: root/test/buildtool/file_system/directory_entries.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/buildtool/file_system/directory_entries.test.cpp')
-rw-r--r--test/buildtool/file_system/directory_entries.test.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/buildtool/file_system/directory_entries.test.cpp b/test/buildtool/file_system/directory_entries.test.cpp
index ed32ff65..86f91493 100644
--- a/test/buildtool/file_system/directory_entries.test.cpp
+++ b/test/buildtool/file_system/directory_entries.test.cpp
@@ -119,3 +119,34 @@ TEST_CASE("Get entries of a git tree", "[directory_entries]") {
CHECK(counter == 2);
}
}
+
+TEST_CASE("Get entries of an empty directory", "[directory_entries]") {
+ // CreateDirectoryEntriesMap returns
+ // FileRoot::DirectoryEntries{FileRoot::DirectoryEntries::pairs_t{}} in case
+ // of a missing directory, which represents an empty directory
+
+ auto dir_entries =
+ FileRoot::DirectoryEntries{FileRoot::DirectoryEntries::pairs_t{}};
+ // of course, no files should be there
+ CHECK_FALSE(dir_entries.ContainsFile("test_repo.bundle"));
+ {
+ // FilesIterator should be an empty range
+ auto counter = 0;
+ for (const auto& x : dir_entries.FilesIterator()) {
+ CHECK_FALSE(dir_entries.ContainsFile(x)); // should never be called
+ ++counter;
+ }
+
+ CHECK(counter == 0);
+ }
+ {
+ // DirectoriesIterator should be an empty range
+ auto counter = 0;
+ for (const auto& x : dir_entries.DirectoriesIterator()) {
+ CHECK(dir_entries.ContainsFile(x)); // should never be called
+ ++counter;
+ }
+
+ CHECK(counter == 0);
+ }
+} \ No newline at end of file