diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-16 16:28:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-16 16:28:54 +0300 |
commit | 0a849f982988cbd7c7afdedccb210bada702238b (patch) | |
tree | 93fe4838817db6e57c7dbc364dd347d275c67937 /src/fs/virtfs/virtfs1_unittest.cc | |
parent | b60b3123345a619aab656c1c361c2c8c42e6455c (diff) | |
download | mv-0a849f982988cbd7c7afdedccb210bada702238b.tar.gz mv-0a849f982988cbd7c7afdedccb210bada702238b.tar.bz2 mv-0a849f982988cbd7c7afdedccb210bada702238b.tar.xz mv-0a849f982988cbd7c7afdedccb210bada702238b.zip |
Add subdir support in VirtFs::isDirectory.
Diffstat (limited to 'src/fs/virtfs/virtfs1_unittest.cc')
-rw-r--r-- | src/fs/virtfs/virtfs1_unittest.cc | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc index 57d82e9af..ae3c00118 100644 --- a/src/fs/virtfs/virtfs1_unittest.cc +++ b/src/fs/virtfs/virtfs1_unittest.cc @@ -2004,6 +2004,75 @@ TEST_CASE("VirtFs1 isDirectory2") delete2(logger); } +TEST_CASE("VirtFs1 isDirectory3") +{ + VirtFs::init("."); + logger = new Logger(); + std::string name("data/test/test.zip"); + std::string prefix; + if (Files::existsLocal(name) == false) + prefix = "../" + prefix; + + VirtFs::mountDir2(prefix + "data", + "test", + Append_false); + + REQUIRE(VirtFs::isDirectory("units.xml") == false); + REQUIRE(VirtFs::isDirectory("units.xml/") == false); + REQUIRE(VirtFs::isDirectory("units123.xml") == false); + REQUIRE(VirtFs::isDirectory("tesQ/units.xml") == false); + REQUIRE(VirtFs::isDirectory("tesQ//units.xml") == false); + REQUIRE(VirtFs::isDirectory("test") == false); + REQUIRE(VirtFs::isDirectory("dir1") == true); + REQUIRE(VirtFs::isDirectory("dir2//") == true); + REQUIRE(VirtFs::isDirectory("test/dir1") == false); + REQUIRE(VirtFs::isDirectory("testQ") == false); + REQUIRE(VirtFs::isDirectory("testQ/") == false); + REQUIRE(VirtFs::isDirectory("testQ//") == false); + + VirtFs::unmountDirSilent2(prefix + "data", + "test"); + VirtFs::deinit(); + delete2(logger); +} + +TEST_CASE("VirtFs1 isDirectory4") +{ + 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); + + REQUIRE(VirtFs::isDirectory("dir2/units.xml") == false); + REQUIRE(VirtFs::isDirectory("dir2/units.xml/") == false); + REQUIRE(VirtFs::isDirectory("dir2//units.xml") == false); + REQUIRE(VirtFs::isDirectory("dir2/units123.xml") == false); + REQUIRE(VirtFs::isDirectory("dir2//units123.xml") == false); + REQUIRE(VirtFs::isDirectory("tesQ/units.xml") == false); + REQUIRE(VirtFs::isDirectory("tesQ//units.xml") == false); + REQUIRE(VirtFs::isDirectory("units.xml") == false); + REQUIRE(VirtFs::isDirectory("1") == true); + REQUIRE(VirtFs::isDirectory("gpl") == true); + REQUIRE(VirtFs::isDirectory("dir2/") == false); + REQUIRE(VirtFs::isDirectory("dir/1") == false); + REQUIRE(VirtFs::isDirectory("dir/1/zzz") == false); + REQUIRE(VirtFs::isDirectory("test/dir1\\") == false); + REQUIRE(VirtFs::isDirectory("testQ") == false); + REQUIRE(VirtFs::isDirectory("testQ/") == false); + REQUIRE(VirtFs::isDirectory("testQ//") == false); + + VirtFs::unmountZip2(prefix + "data/test/test2.zip", + "dir"); + VirtFs::deinit(); + delete2(logger); +} + TEST_CASE("VirtFs1 openRead1") { VirtFs::init("."); |