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 d6d4eb85..5a450fd5 100644
--- a/test/utils/cpp/path.test.cpp
+++ b/test/utils/cpp/path.test.cpp
@@ -32,3 +32,11 @@ TEST_CASE("normalization", "[path]") {
CHECK(ToNormalPath(std::filesystem::path{"foo/.."}).string() == ".");
CHECK(ToNormalPath(std::filesystem::path{"./foo/.."}).string() == ".");
}
+
+TEST_CASE("non-upwards condition", "[path]") {
+ CHECK_FALSE(PathIsNonUpwards("/foo")); // absolute path
+ CHECK(PathIsNonUpwards("foo")); // relative non-upwards
+ CHECK_FALSE(PathIsNonUpwards("../foo")); // relative not non-upwards
+ CHECK_FALSE(PathIsNonUpwards(
+ "foo/../bar/../../foo")); // relative with non-upwards indirection
+}