Changeset 69eaaeee in mainline
- Timestamp:
- 2019-02-14T14:56:18Z (6 years ago)
- Parents:
- 9e7406a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/test/getopt.c
r9e7406a r69eaaeee 272 272 } 273 273 274 PCUT_TEST(getopt_flag_whitespace)275 {276 int argc = 2;277 const char *argv[] = {278 "get_opt_test",279 "-p -f",280 };281 282 const char *options = "pf";283 284 int ret;285 optreset = 1;286 opterr = 0;287 288 ret = getopt(argc, (char *const *)argv, options);289 290 PCUT_ASSERT_INT_EQUALS('p', ret);291 PCUT_ASSERT_INT_EQUALS(1, optind);292 293 ret = getopt(argc, (char *const *)argv, options);294 295 PCUT_ASSERT_INT_EQUALS('f', ret);296 PCUT_ASSERT_INT_EQUALS(1, optind);297 298 ret = getopt(argc, (char *const *)argv, options);299 PCUT_ASSERT_INT_EQUALS(-1, ret);300 }301 302 PCUT_TEST(getopt_param_whitespace)303 {304 int argc = 2;305 const char *argv[] = {306 "get_opt_test",307 "-p param",308 };309 310 const char *options = "p:";311 312 int ret;313 optreset = 1;314 opterr = 0;315 316 ret = getopt(argc, (char *const *)argv, options);317 318 PCUT_ASSERT_INT_EQUALS('p', ret);319 PCUT_ASSERT_INT_EQUALS(2, optind);320 PCUT_ASSERT_STR_EQUALS(" param", optarg);321 322 ret = getopt(argc, (char *const *)argv, options);323 PCUT_ASSERT_INT_EQUALS(-1, ret);324 }325 326 274 PCUT_TEST(getopt_optional_param) 327 275 {
Note:
See TracChangeset
for help on using the changeset viewer.