From: Yu Watanabe Date: Tue, 30 May 2023 09:47:48 +0000 (+0900) Subject: test: add more test cases about path_startswith() X-Git-Tag: v254-rc1~275^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7aef22724b7700dfbd32f82fd39600aff5164c8;p=thirdparty%2Fsystemd.git test: add more test cases about path_startswith() --- diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 6b685a816f0..31e2a3d296a 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -600,6 +600,17 @@ TEST(path_startswith) { test_path_startswith_one("/foo/bar/barfoo/", "////foo/bar/barfoo/", "/foo/bar/barfoo/", ""); test_path_startswith_one("/foo/bar/barfoo/", "/foo/bar/barfoo", "/foo/bar/barfoo/", ""); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo", "/foo/./", "bar///barfoo/./."); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo/", "/foo/./", "bar///barfoo/./."); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/", "/", "foo/./bar///barfoo/./."); + test_path_startswith_one("/foo/./bar///barfoo/./.", "////", "/", "foo/./bar///barfoo/./."); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo//bar/////barfoo///", "/foo/./bar///barfoo/./.", ""); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo/bar/barfoo////", "/foo/./bar///barfoo/./.", ""); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo/bar///barfoo/", "/foo/./bar///barfoo/./.", ""); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo////bar/barfoo/", "/foo/./bar///barfoo/./.", ""); + test_path_startswith_one("/foo/./bar///barfoo/./.", "////foo/bar/barfoo/", "/foo/./bar///barfoo/./.", ""); + test_path_startswith_one("/foo/./bar///barfoo/./.", "/foo/bar/barfoo", "/foo/./bar///barfoo/./.", ""); + test_path_startswith_one("/foo/bar/barfoo/", "/foo/bar/barfooa/", NULL, NULL); test_path_startswith_one("/foo/bar/barfoo/", "/foo/bar/barfooa", NULL, NULL); test_path_startswith_one("/foo/bar/barfoo/", "", NULL, NULL);