Changes in tests/check_util.c [b40e60d:269580c]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/check_util.c
rb40e60d r269580c 167 167 http_encode( s ); 168 168 fail_unless( strcmp( s, "ee%C3%ABee%21%21..." ) == 0 ); 169 END_TEST 170 171 struct { 172 int limit; 173 char *command; 174 char *expected[IRC_MAX_ARGS+1]; 175 } split_tests[] = { 176 { 177 0, "account add etc \"user name with spaces\" 'pass\\ word'", 178 {"account", "add", "etc", "user name with spaces", "pass\\ word", NULL}, 179 }, 180 { 181 0, "channel set group Close\\ friends", 182 {"channel", "set", "group", "Close friends", NULL}, 183 }, 184 { 185 2, "reply wilmer \"testing in C is a PITA\", you said.", 186 {"reply", "wilmer", "\"testing in C is a PITA\", you said.", NULL}, 187 }, 188 { 189 4, "one space two spaces limit limit", 190 {"one", "space", "two", "spaces", "limit limit", NULL}, 191 }, 192 { 193 0, NULL, 194 {NULL} 195 }, 196 }; 197 198 START_TEST(test_split_command_parts) 199 int i; 200 for (i = 0; split_tests[i].command; i++) { 201 char *cmd = g_strdup(split_tests[i].command); 202 char **split = split_command_parts(cmd, split_tests[i].limit); 203 char **expected = split_tests[i].expected; 204 205 int j; 206 for (j = 0; split[j] && expected[j]; j++) { 207 fail_unless (strcmp(split[j], expected[j]) == 0, 208 "(%d) split_command_parts broken: split(\"%s\")[%d] -> %s (expected: %s)", 209 i, split_tests[i].command, j, split[j], expected[j]); 210 } 211 g_free(cmd); 212 } 169 213 END_TEST 170 214 … … 183 227 tcase_add_test (tc_core, test_word_wrap); 184 228 tcase_add_test (tc_core, test_http_encode); 229 tcase_add_test (tc_core, test_split_command_parts); 185 230 return s; 186 231 }
Note: See TracChangeset
for help on using the changeset viewer.