test/utils.c

branch
dav-2
changeset 898
d87fbe697f9b
parent 897
d684ba9e2da0
equal deleted inserted replaced
897:d684ba9e2da0 898:d87fbe697f9b
85 //CX_TEST_ASSERT(path && !strcmp(path, "http://example.com/")); 85 //CX_TEST_ASSERT(path && !strcmp(path, "http://example.com/"));
86 //free(path); 86 //free(path);
87 } 87 }
88 } 88 }
89 89
90 CX_TEST(test_util_resource_name) {
91 CX_TEST_DO {
92 const char *name = util_resource_name("test.txt");
93 CX_TEST_ASSERT(!cx_strcmp(name, "test.txt"));
94
95 name = util_resource_name("dir/file");
96 CX_TEST_ASSERT(!cx_strcmp(name, "file"));
97
98 name = util_resource_name("long/path/with/multiple/subdirs/hello");
99 CX_TEST_ASSERT(!cx_strcmp(name, "hello"));
100
101 name = util_resource_name("http://example.com/path/index.html");
102 CX_TEST_ASSERT(!cx_strcmp(name, "index.html"));
103 }
104 }
105
90 CX_TEST(test_util_concat_path) { 106 CX_TEST(test_util_concat_path) {
91 CX_TEST_DO { 107 CX_TEST_DO {
92 char *str = util_concat_path("", ""); 108 char *str = util_concat_path("", "");
93 CX_TEST_ASSERT(str); 109 CX_TEST_ASSERT(str);
94 CX_TEST_ASSERT(!strcmp(str, "/")); 110 CX_TEST_ASSERT(!strcmp(str, "/"));

mercurial