diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-30 17:57:21 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-06-26 17:57:29 +0200 |
commit | 0b924c5c23a89760ddecf8d8f6baa19333f9b667 (patch) | |
tree | 53be66938dcfd1f38a7dea98566e6de39d6df10f /test/utils/cpp | |
parent | b94f1b857c6bc1eab909c4fb9a0ba569d6d28a03 (diff) | |
download | justbuild-0b924c5c23a89760ddecf8d8f6baa19333f9b667.tar.gz |
filesystem: Add logic for handling (non-upwards) symlinks
Diffstat (limited to 'test/utils/cpp')
-rw-r--r-- | test/utils/cpp/path.test.cpp | 8 |
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 +} |