summaryrefslogtreecommitdiff
path: root/src/unittest
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2016-12-16 17:35:58 -0500
committerCraig Robbins <kde.psych@gmail.com>2016-12-20 17:17:38 +1000
commitf522e7351a1eaffcd4b0f1f06fab65a44281f972 (patch)
tree0f15074f71d5a57f19dc2a534d9d12fe2b57538a /src/unittest
parent59f84ca0a07e50dd5ce050d38ae1aeb529bd25ac (diff)
downloadminetest-f522e7351a1eaffcd4b0f1f06fab65a44281f972.tar.gz
minetest-f522e7351a1eaffcd4b0f1f06fab65a44281f972.tar.bz2
minetest-f522e7351a1eaffcd4b0f1f06fab65a44281f972.zip
Fix RemoveRelatvePathComponents
This used to return "/foo" for "../foo" when it should return the enpty string (i.e., error removing all relative components).
Diffstat (limited to 'src/unittest')
-rw-r--r--src/unittest/test_filepath.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unittest/test_filepath.cpp b/src/unittest/test_filepath.cpp
index 5e3cdcc08..ac2d69b5a 100644
--- a/src/unittest/test_filepath.cpp
+++ b/src/unittest/test_filepath.cpp
@@ -251,7 +251,10 @@ void TestFilePath::testRemoveRelativePathComponent()
UASSERT(result == p("/home/user/minetest/worlds/world1"));
path = p(".");
result = fs::RemoveRelativePathComponents(path);
- UASSERT(result == ".");
+ UASSERT(result == "");
+ path = p("../a");
+ result = fs::RemoveRelativePathComponents(path);
+ UASSERT(result == "");
path = p("./subdir/../..");
result = fs::RemoveRelativePathComponents(path);
UASSERT(result == "");