Changes in tests/check_util.c [269580c:b40e60d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/check_util.c
r269580c rb40e60d 169 169 END_TEST 170 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 }213 END_TEST214 215 171 Suite *util_suite (void) 216 172 { … … 227 183 tcase_add_test (tc_core, test_word_wrap); 228 184 tcase_add_test (tc_core, test_http_encode); 229 tcase_add_test (tc_core, test_split_command_parts);230 185 return s; 231 186 }
Note: See TracChangeset
for help on using the changeset viewer.