diff options
author | Sven Eden <yamakuzure@gmx.net> | 2018-03-13 19:19:10 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-03-26 18:26:00 +0200 |
commit | 8a17d92e544e7842a5740d7a66e0ef93daca18e6 (patch) | |
tree | 1a4ebb1727461cbbe273d5c871edadb95338acc3 /src/test/test-path-util.c | |
parent | 5faa59dd74a00a52bada4fbf85c9329224c5f68f (diff) |
Prep v236 : Add missing SPDX-License-Identifier (8/9) src/test
Diffstat (limited to 'src/test/test-path-util.c')
-rw-r--r-- | src/test/test-path-util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 5772f3aa0..b2b5fd19f 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ /*** This file is part of systemd. @@ -400,6 +401,21 @@ static void test_file_in_same_dir(void) { free(t); } +static void test_last_path_component(void) { + assert_se(streq(last_path_component("a/b/c"), "c")); + assert_se(streq(last_path_component("a/b/c/"), "c/")); + assert_se(streq(last_path_component("/"), "/")); + assert_se(streq(last_path_component("//"), "/")); + assert_se(streq(last_path_component("///"), "/")); + assert_se(streq(last_path_component("."), ".")); + assert_se(streq(last_path_component("./."), ".")); + assert_se(streq(last_path_component("././"), "./")); + assert_se(streq(last_path_component("././/"), ".//")); + assert_se(streq(last_path_component("/foo/a"), "a")); + assert_se(streq(last_path_component("/foo/a/"), "a/")); + assert_se(streq(last_path_component(""), "")); +} + static void test_filename_is_valid(void) { char foo[FILENAME_MAX+2]; int i; @@ -489,6 +505,7 @@ int main(int argc, char **argv) { test_path_startswith(); test_prefix_root(); test_file_in_same_dir(); + test_last_path_component(); test_filename_is_valid(); test_hidden_or_backup_file(); test_skip_dev_prefix(); |