summaryrefslogtreecommitdiff
path: root/src/fs/virtfs_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-23 01:06:11 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-23 01:06:11 +0300
commit2b6106c41f3959d4deb8efc58c9055de0339959e (patch)
tree2ae271cd59997d4fe128e0173c0224e28417b34b /src/fs/virtfs_unittest.cc
parent76667ef0fa911fc8bf37df72896645dbfbbc0763 (diff)
downloadmanaplus-2b6106c41f3959d4deb8efc58c9055de0339959e.tar.gz
manaplus-2b6106c41f3959d4deb8efc58c9055de0339959e.tar.bz2
manaplus-2b6106c41f3959d4deb8efc58c9055de0339959e.tar.xz
manaplus-2b6106c41f3959d4deb8efc58c9055de0339959e.zip
Impliment basic VirtFsDir for virtual fs based on directories.
Api similar to VirtFs. VirtFsDir unused for now.
Diffstat (limited to 'src/fs/virtfs_unittest.cc')
-rw-r--r--src/fs/virtfs_unittest.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/fs/virtfs_unittest.cc b/src/fs/virtfs_unittest.cc
index 4f3a74a7b..b26381f08 100644
--- a/src/fs/virtfs_unittest.cc
+++ b/src/fs/virtfs_unittest.cc
@@ -106,7 +106,7 @@ static void removeTemp(StringVect &restrict list)
}
}
-TEST_CASE("VirtFs enumerateFiles")
+TEST_CASE("VirtFs enumerateFiles1")
{
logger = new Logger;
@@ -115,8 +115,8 @@ TEST_CASE("VirtFs enumerateFiles")
VirtList *list = nullptr;
- const int cnt1 = VirtFs::exists("test/test2.txt") ? 23 : 22;
- const int cnt2 = 23;
+ const int cnt1 = VirtFs::exists("test/test2.txt") ? 24 : 23;
+ const int cnt2 = 24;
VirtFs::permitLinks(false);
list = VirtFs::enumerateFiles("test");
@@ -142,6 +142,27 @@ TEST_CASE("VirtFs enumerateFiles")
delete2(logger);
}
+TEST_CASE("VirtFs enumerateFiles2")
+{
+ logger = new Logger;
+
+ VirtFs::addDirToSearchPath("data/test/dir1",
+ Append_false);
+ VirtFs::addDirToSearchPath("../data/test/dir1",
+ Append_false);
+
+ VirtList *list = nullptr;
+
+ list = VirtFs::enumerateFiles("/");
+ const size_t sz = list->names.size();
+ REQUIRE(list->names.size() == 5);
+ VirtFs::freeList(list);
+
+ VirtFs::removeDirFromSearchPath("data/test/dir1");
+ VirtFs::removeDirFromSearchPath("../data/test/dir1");
+ delete2(logger);
+}
+
TEST_CASE("VirtFs isDirectory")
{
logger = new Logger();