summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-21 01:24:37 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-21 01:24:37 +0100
commit3c659c2737b26d8ee28c727b277325852df8dd09 (patch)
tree6ad31953923b16eb8b12b679b1effd463dfd9376 /test
parent6decad0b8e7e369bd8215f31a45dd3eae982d2a9 (diff)
Do only perform relative file lookups if a relative path is given (to allow users to include files without accidently including a global resource)
Diffstat (limited to 'test')
-rw-r--r--test/plugins/filesystem/FileLocatorTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/plugins/filesystem/FileLocatorTest.cpp b/test/plugins/filesystem/FileLocatorTest.cpp
index 17d43dd..beb091d 100644
--- a/test/plugins/filesystem/FileLocatorTest.cpp
+++ b/test/plugins/filesystem/FileLocatorTest.cpp
@@ -142,6 +142,26 @@ TEST(FileLocator, testLocate)
assert_not_located(locator, "c.txt", "", ResourceType::SCRIPT);
}
+TEST(FileLocator, testLocateRelative)
+{
+ FileLocator locator;
+ locator.addUnittestSearchPath("filesystem");
+
+ // Add the respective search path
+ locator.addUnittestSearchPath("filesystem/b");
+
+ Resource resA, resC;
+ ASSERT_TRUE(locator.locate(resA, "a.txt"));
+ ASSERT_TRUE(locator.locate(resC, "c.txt"));
+
+ Resource resD;
+ ASSERT_TRUE(locator.locate(resD, "d.txt"));
+ ASSERT_TRUE(locator.locate(resD, "d.txt", ResourceType::UNKNOWN, resA));
+ ASSERT_TRUE(locator.locate(resD, "d.txt", ResourceType::UNKNOWN, resC));
+ ASSERT_FALSE(locator.locate(resD, "./d.txt", ResourceType::UNKNOWN, resA));
+ ASSERT_TRUE(locator.locate(resD, "./d.txt", ResourceType::UNKNOWN, resC));
+}
+
TEST(FileLocator, testStream)
{
FileLocator locator;