# HG changeset patch # User Olaf Wintermann # Date 1768071080 -3600 # Node ID d87fbe697f9be917ba426fa9e0b1415bfb316811 # Parent d684ba9e2da05ed4ca52d49fffaae237ea9f133b add test_util_resource_name diff -r d684ba9e2da0 -r d87fbe697f9b test/main.c --- 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); diff -r d684ba9e2da0 -r d87fbe697f9b test/utils.c --- 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("", ""); diff -r d684ba9e2da0 -r d87fbe697f9b test/utils.h --- a/test/utils.h Fri Jan 09 14:52:34 2026 +0100 +++ b/test/utils.h Sat Jan 10 19:51:20 2026 +0100 @@ -37,6 +37,7 @@ CX_TEST(test_util_parse_creationdate); CX_TEST(test_util_url_base); +CX_TEST(test_util_resource_name); CX_TEST(test_util_concat_path); CX_TEST(test_util_path_isrelated);