diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-28 20:13:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-28 20:13:55 +0300 |
commit | 993e6f9b9606a71ad35302f0767017fd426c1d0e (patch) | |
tree | 13a8bc658412348d8ea2d248b8d6b6a684f1e541 /src/fs/virtfszip_unittest.cc | |
parent | c33ecc43f775eebae66e5ad0dc5f9588162b3783 (diff) | |
download | mv-993e6f9b9606a71ad35302f0767017fd426c1d0e.tar.gz mv-993e6f9b9606a71ad35302f0767017fd426c1d0e.tar.bz2 mv-993e6f9b9606a71ad35302f0767017fd426c1d0e.tar.xz mv-993e6f9b9606a71ad35302f0767017fd426c1d0e.zip |
Fix files enumeration in root directory in VirtFsZip.
Also add tests for same for other VirtFs functions.
Diffstat (limited to 'src/fs/virtfszip_unittest.cc')
-rw-r--r-- | src/fs/virtfszip_unittest.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/fs/virtfszip_unittest.cc b/src/fs/virtfszip_unittest.cc index 3eb8a2357..4840a23a9 100644 --- a/src/fs/virtfszip_unittest.cc +++ b/src/fs/virtfszip_unittest.cc @@ -397,6 +397,57 @@ TEST_CASE("VirtFsZip enumerateFiles2") delete2(logger); } +TEST_CASE("VirtFsZip enumerateFiles3") +{ + VirtFsZip::init(); + logger = new Logger; + std::string name("data/test/test.zip"); + std::string prefix("data\\test/"); + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + + VirtFsZip::addToSearchPathSilent(prefix + "test.zip", + Append_false); + + VirtList *list = nullptr; + + list = VirtFsZip::enumerateFiles("/"); + REQUIRE(list->names.size() == 1); + REQUIRE(inList(list, "dir")); + VirtFsZip::freeList(list); + + VirtFsZip::removeFromSearchPathSilent(prefix + "test.zip"); + VirtFsZip::deinit(); + delete2(logger); +} + +TEST_CASE("VirtFsZip enumerateFiles4") +{ + VirtFsZip::init(); + logger = new Logger; + std::string name("data/test/test.zip"); + std::string prefix("data\\test/"); + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + + VirtFsZip::addToSearchPathSilent(prefix + "test2.zip", + Append_false); + + VirtList *list = nullptr; + + list = VirtFsZip::enumerateFiles("/"); + REQUIRE(list->names.size() == 4); + REQUIRE(inList(list, "dir")); + REQUIRE(inList(list, "dir2")); + REQUIRE(inList(list, "test.txt")); + REQUIRE(inList(list, "units.xml")); + VirtFsZip::freeList(list); + + VirtFsZip::removeFromSearchPathSilent(prefix + "test2.zip"); + VirtFsZip::deinit(); + delete2(logger); +} + TEST_CASE("VirtFsZip isDirectory") { VirtFsZip::init(); |