diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-16 18:22:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-16 18:22:09 +0300 |
commit | 873eff85f179593d486793be24b3cfaf73226e1f (patch) | |
tree | 23cfa3747f31a853f13c251b247312ddbcd70b53 /src/fs/virtfs/virtfs1_unittest.cc | |
parent | 5844f83998040d4a79dc442151a21dc17de60feb (diff) | |
download | manaverse-873eff85f179593d486793be24b3cfaf73226e1f.tar.gz manaverse-873eff85f179593d486793be24b3cfaf73226e1f.tar.bz2 manaverse-873eff85f179593d486793be24b3cfaf73226e1f.tar.xz manaverse-873eff85f179593d486793be24b3cfaf73226e1f.zip |
Add subdir support in VirtFs::getDirs.
Diffstat (limited to 'src/fs/virtfs/virtfs1_unittest.cc')
-rw-r--r-- | src/fs/virtfs/virtfs1_unittest.cc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc index 43834d87e..c703e3717 100644 --- a/src/fs/virtfs/virtfs1_unittest.cc +++ b/src/fs/virtfs/virtfs1_unittest.cc @@ -3240,6 +3240,67 @@ TEST_CASE("VirtFs1 getDirs2") delete2(logger); } +TEST_CASE("VirtFs1 getDirs3") +{ + VirtFs::init("."); + logger = new Logger(); + std::string name("data/test/test.zip"); + std::string prefix; + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + + VirtFs::mountZip2(prefix + "data/test/test2.zip", + "dir", + Append_false); + + StringVect list; + VirtFs::getDirs(dirSeparator, list); + REQUIRE(list.size() == 2); + REQUIRE(inList(list, "1")); + REQUIRE(inList(list, "gpl")); + list.clear(); + + VirtFs::getDirs("1", list); + REQUIRE(list.size() == 0); + + VirtFs::unmountZip2(prefix + "data/test/test2.zip", + "dir"); + VirtFs::deinit(); + delete2(logger); +} + +TEST_CASE("VirtFs1 getDirs4") +{ + VirtFs::init("."); + logger = new Logger(); + std::string name("data/test/test.zip"); + std::string prefix; + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + StringVect list; + + SECTION("dir1") + { + VirtFs::mountDir2(prefix + "data", + "test", + Append_false); + + VirtFs::getDirs("/", list); + REQUIRE(inList(list, "dir1")); + REQUIRE(inList(list, "dir2")); + list.clear(); + + VirtFs::getDirs("dir1", list); + REQUIRE(list.size() == 0); + + VirtFs::unmountDir2(prefix + "data", + "test"); + } + + VirtFs::deinit(); + delete2(logger); +} + TEST_CASE("VirtFs1 getFilesWithDir1") { VirtFs::init("."); |