summaryrefslogtreecommitdiff
path: root/src/fs/virtfs/virtfs_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-16 02:41:29 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-16 02:41:29 +0300
commitcfb75b015a4e70843e571ce599e11bf2990abc1b (patch)
tree6ad173a6e0343364fc5ee747171f652b49ff4cce /src/fs/virtfs/virtfs_unittest.cc
parent24bd6a6d26bab89126db7183bb693779a1742c6d (diff)
downloadmv-cfb75b015a4e70843e571ce599e11bf2990abc1b.tar.gz
mv-cfb75b015a4e70843e571ce599e11bf2990abc1b.tar.bz2
mv-cfb75b015a4e70843e571ce599e11bf2990abc1b.tar.xz
mv-cfb75b015a4e70843e571ce599e11bf2990abc1b.zip
Add subdir support into VirtFs::getRealDir.
Diffstat (limited to 'src/fs/virtfs/virtfs_unittest.cc')
-rw-r--r--src/fs/virtfs/virtfs_unittest.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc
index 3718fddda..d6ab42ff4 100644
--- a/src/fs/virtfs/virtfs_unittest.cc
+++ b/src/fs/virtfs/virtfs_unittest.cc
@@ -747,6 +747,37 @@ TEST_CASE("VirtFs getrealDir2")
delete2(logger);
}
+TEST_CASE("VirtFs getrealDir3")
+{
+ logger = new Logger();
+ const std::string sep = dirSeparator;
+ 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);
+ VirtFs::mountDir(prefix + "data/test", Append_false);
+
+ REQUIRE(VirtFs::getRealDir("zzz") == "");
+
+ REQUIRE(VirtFs::getRealDir("dir1/file1.txt") ==
+ prefix + "data" + sep + "test");
+ REQUIRE(VirtFs::getRealDir("hide.png") ==
+ prefix + "data" + sep + "test");
+ REQUIRE(VirtFs::getRealDir("hide.png") ==
+ prefix + "data" + sep + "test");
+ REQUIRE(VirtFs::getRealDir("1//test.txt") ==
+ prefix + "data" + sep + "test" + sep + "test2.zip");
+
+ VirtFs::unmountZip2(prefix + "data/test/test2.zip",
+ "dir");
+ VirtFs::unmountDir(prefix + "data/test");
+ delete2(logger);
+}
+
TEST_CASE("VirtFs permitLinks")
{
logger = new Logger();