summaryrefslogtreecommitdiff
path: root/src/fs/virtfs/virtfs_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/virtfs/virtfs_unittest.cc')
-rw-r--r--src/fs/virtfs/virtfs_unittest.cc41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc
index d6ab42ff4..24b9232fc 100644
--- a/src/fs/virtfs/virtfs_unittest.cc
+++ b/src/fs/virtfs/virtfs_unittest.cc
@@ -778,7 +778,7 @@ TEST_CASE("VirtFs getrealDir3")
delete2(logger);
}
-TEST_CASE("VirtFs permitLinks")
+TEST_CASE("VirtFs permitLinks1")
{
logger = new Logger();
VirtFs::mountDirSilent("data", Append_false);
@@ -811,6 +811,45 @@ TEST_CASE("VirtFs permitLinks")
delete2(logger);
}
+TEST_CASE("VirtFs permitLinks2")
+{
+ logger = new Logger();
+ VirtFs::mountDirSilent2("data",
+ "test",
+ Append_false);
+ VirtFs::mountDirSilent2("../data",
+ "test",
+ Append_false);
+
+ const int cnt1 = VirtFs::exists("test2.txt") ? 26 : 25;
+ const int cnt2 = 26;
+
+ StringVect list;
+ VirtFs::permitLinks(false);
+ VirtFs::getFiles(dirSeparator, list);
+ removeTemp(list);
+ const size_t sz = list.size();
+ REQUIRE(sz == cnt1);
+
+ list.clear();
+ VirtFs::permitLinks(true);
+ VirtFs::getFiles(dirSeparator, list);
+ removeTemp(list);
+ REQUIRE(list.size() == cnt2);
+
+ list.clear();
+ VirtFs::permitLinks(false);
+ VirtFs::getFiles(dirSeparator, list);
+ removeTemp(list);
+ REQUIRE(list.size() == cnt1);
+
+ VirtFs::unmountDirSilent2("data",
+ "test");
+ VirtFs::unmountDirSilent2("../data",
+ "test");
+ delete2(logger);
+}
+
TEST_CASE("VirtFs read1")
{
logger = new Logger();