summaryrefslogtreecommitdiff
path: root/test/utils/cpp/path.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/utils/cpp/path.test.cpp')
-rw-r--r--test/utils/cpp/path.test.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/utils/cpp/path.test.cpp b/test/utils/cpp/path.test.cpp
index 5a450fd5..7a0ac1fe 100644
--- a/test/utils/cpp/path.test.cpp
+++ b/test/utils/cpp/path.test.cpp
@@ -40,3 +40,11 @@ TEST_CASE("non-upwards condition", "[path]") {
CHECK_FALSE(PathIsNonUpwards(
"foo/../bar/../../foo")); // relative with non-upwards indirection
}
+
+TEST_CASE("confined upwards condition", "[path]") {
+ CHECK_FALSE(PathIsConfined("/foo", "dummy")); // absolute path
+ CHECK(PathIsConfined("foo", "dummy")); // relative non-upwards
+ CHECK(PathIsConfined("../foo", "dummy/bar")); // upwards, but confined
+ CHECK_FALSE(PathIsConfined("foo/../bar/../../../foo",
+ "dummy")); // upwards, not confined
+}