tests: clarify test_path_startswith return value (#4508)
A pendant for #4481.
This commit is contained in:
parent
87b6ba21b5
commit
0470289b6e
2 changed files with 41 additions and 10 deletions
|
@ -263,16 +263,37 @@ static void test_strv_resolve(void) {
|
|||
}
|
||||
|
||||
static void test_path_startswith(void) {
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo/"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "////"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo//bar/////barfoo///"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo/bar/barfoo////"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo/bar///barfoo/"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo////bar/barfoo/"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "////foo/bar/barfoo/"));
|
||||
assert_se(path_startswith("/foo/bar/barfoo/", "/foo/bar/barfoo"));
|
||||
const char *p;
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo");
|
||||
assert_se(streq_ptr(p, "bar/barfoo/"));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo/");
|
||||
assert_se(streq_ptr(p, "bar/barfoo/"));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/");
|
||||
assert_se(streq_ptr(p, "foo/bar/barfoo/"));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "////");
|
||||
assert_se(streq_ptr(p, "foo/bar/barfoo/"));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo//bar/////barfoo///");
|
||||
assert_se(streq_ptr(p, ""));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo/bar/barfoo////");
|
||||
assert_se(streq_ptr(p, ""));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo/bar///barfoo/");
|
||||
assert_se(streq_ptr(p, ""));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo////bar/barfoo/");
|
||||
assert_se(streq_ptr(p, ""));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "////foo/bar/barfoo/");
|
||||
assert_se(streq_ptr(p, ""));
|
||||
|
||||
p = path_startswith("/foo/bar/barfoo/", "/foo/bar/barfoo");
|
||||
assert_se(streq_ptr(p, ""));
|
||||
|
||||
assert_se(!path_startswith("/foo/bar/barfoo/", "/foo/bar/barfooa/"));
|
||||
assert_se(!path_startswith("/foo/bar/barfoo/", "/foo/bar/barfooa"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue