From 4872c6216a26d575f5db0afd13da61d01c5630b1 Mon Sep 17 00:00:00 2001 From: Jan Boon Date: Tue, 10 Feb 2026 05:51:25 +0000 Subject: [PATCH] common : additional test case --- tests/test-fs-validate-filename.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test-fs-validate-filename.cpp b/tests/test-fs-validate-filename.cpp index 5a194fef1a..d21cf0dfe8 100644 --- a/tests/test-fs-validate-filename.cpp +++ b/tests/test-fs-validate-filename.cpp @@ -155,6 +155,12 @@ int main(void) { std::string("a") + SEP + "b" + SEP + "c" + SEP + "d.txt", "/a//b\\c/d.txt"); + // --- normalize doesn't validate and doesn't trim dot segments in the middle of the path --- + test_normalize("dotdot retained", std::string("foo") + SEP + ".." + SEP + "bar", "foo/../bar"); + test_normalize("dotdot at start retained", std::string("..") + SEP + "bar", "../bar"); + test_normalize("dotdot at end retained", std::string("foo") + SEP + "..", "foo/.."); + test_normalize("dot component retained mid", std::string("foo") + SEP + "." + SEP + "bar", "foo/./bar"); + if (n_failed) { printf("\n%d/%d tests failed\n", n_failed, n_tests); fflush(stdout);