diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-16 04:28:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-16 04:28:44 +0300 |
commit | b60b3123345a619aab656c1c361c2c8c42e6455c (patch) | |
tree | cf0d79476fe236f448603788da55b7c3d6aaf47b /src/fs/virtfs/virtfs1_unittest.cc | |
parent | cfb75b015a4e70843e571ce599e11bf2990abc1b (diff) | |
download | mv-b60b3123345a619aab656c1c361c2c8c42e6455c.tar.gz mv-b60b3123345a619aab656c1c361c2c8c42e6455c.tar.bz2 mv-b60b3123345a619aab656c1c361c2c8c42e6455c.tar.xz mv-b60b3123345a619aab656c1c361c2c8c42e6455c.zip |
Add subdir support into VirtFs::enumerateFiles.
Diffstat (limited to 'src/fs/virtfs/virtfs1_unittest.cc')
-rw-r--r-- | src/fs/virtfs/virtfs1_unittest.cc | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc index 264f92079..57d82e9af 100644 --- a/src/fs/virtfs/virtfs1_unittest.cc +++ b/src/fs/virtfs/virtfs1_unittest.cc @@ -1754,6 +1754,106 @@ TEST_CASE("VirtFsZip enumerateFiles9") delete2(logger); } +TEST_CASE("VirtFsZip enumerateFiles10") +{ + VirtFs::init("."); + logger = new Logger; + std::string name("data/test/test.zip"); + std::string prefix("data\\test/"); + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + + VirtFs::mountZip2(prefix + "test.zip", + "dir", + Append_false); + + VirtFs::List *list = nullptr; + + list = VirtFs::enumerateFiles("/"); + REQUIRE(list->names.size() == 2); + REQUIRE(inList(list, "brimmedhat.png")); + REQUIRE(inList(list, "hide.png")); + VirtFs::freeList(list); + + VirtFs::unmountZip2(prefix + "test.zip", + "dir"); + VirtFs::deinit(); + delete2(logger); +} + +TEST_CASE("VirtFsZip enumerateFiles11") +{ + VirtFs::init("."); + logger = new Logger; + std::string name("data/test/test.zip"); + std::string prefix("data\\test/"); + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + + VirtFs::mountZip2(prefix + "test2.zip", + "dir", + Append_false); + + VirtFs::List *list = nullptr; + + list = VirtFs::enumerateFiles("1"); + REQUIRE(list->names.size() == 2); + REQUIRE(inList(list, "file1.txt")); + REQUIRE(inList(list, "test.txt")); + VirtFs::freeList(list); + + VirtFs::unmountZip2(prefix + "test2.zip", + "dir"); + VirtFs::deinit(); + delete2(logger); +} + +TEST_CASE("VirtFs1 enumerateFiles12") +{ + VirtFs::init("."); + logger = new Logger; + + VirtFs::mountDirSilent2("data/test", + "dir2", + Append_false); + VirtFs::mountDirSilent2("../data/test", + "dir2", + Append_false); + + VirtFs::List *list = nullptr; + + list = VirtFs::enumerateFiles("/"); + REQUIRE(inList(list, "file1.txt")); + REQUIRE(inList(list, "file2.txt")); + VirtFs::freeList(list); + + VirtFs::deinit(); + delete2(logger); +} + +TEST_CASE("VirtFs1 enumerateFiles13") +{ + VirtFs::init("."); + logger = new Logger; + + VirtFs::mountDirSilent2("data", + "test", + Append_false); + VirtFs::mountDirSilent2("../data", + "test", + Append_false); + + VirtFs::List *list = nullptr; + + list = VirtFs::enumerateFiles("dir2"); + REQUIRE(inList(list, "file1.txt")); + REQUIRE(inList(list, "file2.txt")); + VirtFs::freeList(list); + + VirtFs::deinit(); + delete2(logger); +} + TEST_CASE("VirtFs1 isDirectory1") { |