- Timestamp:
- Jan 2, 2011, 3:35:15 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- d222c44
- Parents:
- d275eb2
- git-author:
- David Benjamin <davidben@mit.edu> (12/14/10 23:52:42)
- git-committer:
- David Benjamin <davidben@mit.edu> (01/02/11 15:35:15)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tester.c
re45d9f4 r2bc6ad35 175 175 FAIL_UNLESS("skiptokens 5", 176 176 !strcmp("c d e", skiptokens("a \"'\" c d e", 2))); 177 178 #define CHECK_QUOTING(desc, unquoted, quoted) \ 179 do { \ 180 int __argc; \ 181 char *__quoted = owl_arg_quote(unquoted); \ 182 char **__argv; \ 183 FAIL_UNLESS(desc, !strcmp(quoted, __quoted)); \ 184 __argv = owl_parseline(__quoted, &__argc); \ 185 FAIL_UNLESS(desc " - arg count", __argc == 1); \ 186 FAIL_UNLESS(desc " - parsed", \ 187 !strcmp(__argv[0], unquoted)); \ 188 owl_parse_delete(__argv, __argc); \ 189 owl_free(__quoted); \ 190 } while (0) 191 192 CHECK_QUOTING("boring text", "mango", "mango"); 193 CHECK_QUOTING("spaces", "mangos are tasty", "'mangos are tasty'"); 194 CHECK_QUOTING("single quotes", "mango's", "\"mango's\""); 195 CHECK_QUOTING("double quotes", "he said \"mangos are tasty\"", 196 "'he said \"mangos are tasty\"'"); 197 CHECK_QUOTING("both quotes", 198 "he said \"mango's are tasty even when you put in " 199 "a random apostrophe\"", 200 "\"he said \"'\"'\"mango's are tasty even when you put in " 201 "a random apostrophe\"'\"'\"\""); 202 CHECK_QUOTING("quote monster", "'\"\"'\"'''\"", 203 "\"" 204 "'" 205 "\"'\"'\"" 206 "\"'\"'\"" 207 "'" 208 "\"'\"'\"" 209 "'" 210 "'" 211 "'" 212 "\"'\"'\"" 213 "\""); 177 214 178 215 /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
Note: See TracChangeset
for help on using the changeset viewer.