Sat, 10 Jan 2026 19:51:20 +0100
add test_util_resource_name
| test/main.c | file | annotate | diff | comparison | revisions | |
| test/utils.c | file | annotate | diff | comparison | revisions | |
| test/utils.h | file | annotate | diff | comparison | revisions |
--- a/test/main.c Fri Jan 09 14:52:34 2026 +0100 +++ b/test/main.c Sat Jan 10 19:51:20 2026 +0100 @@ -63,6 +63,7 @@ cx_test_register(suite, test_dav_pw2key); cx_test_register(suite, test_util_parse_creationdate); cx_test_register(suite, test_util_url_base); + cx_test_register(suite, test_util_resource_name); cx_test_register(suite, test_util_concat_path); cx_test_register(suite, test_util_path_isrelated);
--- a/test/utils.c Fri Jan 09 14:52:34 2026 +0100 +++ b/test/utils.c Sat Jan 10 19:51:20 2026 +0100 @@ -87,6 +87,22 @@ } } +CX_TEST(test_util_resource_name) { + CX_TEST_DO { + const char *name = util_resource_name("test.txt"); + CX_TEST_ASSERT(!cx_strcmp(name, "test.txt")); + + name = util_resource_name("dir/file"); + CX_TEST_ASSERT(!cx_strcmp(name, "file")); + + name = util_resource_name("long/path/with/multiple/subdirs/hello"); + CX_TEST_ASSERT(!cx_strcmp(name, "hello")); + + name = util_resource_name("http://example.com/path/index.html"); + CX_TEST_ASSERT(!cx_strcmp(name, "index.html")); + } +} + CX_TEST(test_util_concat_path) { CX_TEST_DO { char *str = util_concat_path("", "");