X-Git-Url: http://git.efficios.com/?p=argpar.git;a=blobdiff_plain;f=tests%2Ftest_argpar.c;h=c78b6e8a6babb71c7b362ba62eb45932e84644fb;hp=4882d45c1c0bade6ca1ef0b0ac7ee9ac755f55b0;hb=dd757a651292048da829dd6fa085c1f107569bcc;hpb=a29790113ff3345f42834c3d9be99bb8055ff071 diff --git a/tests/test_argpar.c b/tests/test_argpar.c index 4882d45..c78b6e8 100644 --- a/tests/test_argpar.c +++ b/tests/test_argpar.c @@ -624,6 +624,32 @@ void succeed_tests(void) "-f --yeah= -f", descrs, 3); } + + /* `-` non-option argument */ + { + const struct argpar_opt_descr descrs[] = { + { 0, 'f', NULL, false }, + ARGPAR_OPT_DESCR_SENTINEL + }; + + test_succeed( + "-f - -f", + "-f -<1,0> -f", + descrs, 3); + } + + /* `--` non-option argument */ + { + const struct argpar_opt_descr descrs[] = { + { 0, 'f', NULL, false }, + ARGPAR_OPT_DESCR_SENTINEL + }; + + test_succeed( + "-f -- -f", + "-f --<1,0> -f", + descrs, 3); + } } /* @@ -837,38 +863,7 @@ void fail_tests(void) descrs); } - /* Invalid `-` */ - { - const struct argpar_opt_descr descrs[] = { - { 0, 'a', NULL, false }, - { 0, 'b', NULL, false }, - { 0, 'c', NULL, true }, - ARGPAR_OPT_DESCR_SENTINEL - }; - - test_fail( - "-ab - -c", - "While parsing argument #2 (`-`): Invalid argument", - ARGPAR_ITER_NEXT_STATUS_ERROR_INVALID_ARG, - descrs); - } - - /* Invalid `--` */ - { - const struct argpar_opt_descr descrs[] = { - { 0, 'a', NULL, false }, - { 0, 'b', NULL, false }, - { 0, 'c', NULL, true }, - ARGPAR_OPT_DESCR_SENTINEL - }; - - test_fail( - "-ab -- -c", - "While parsing argument #2 (`--`): Invalid argument", - ARGPAR_ITER_NEXT_STATUS_ERROR_INVALID_ARG, - descrs); - } - + /* Unexpected long option argument */ { const struct argpar_opt_descr descrs[] = { { 0, 'c', "chevre", false }, @@ -885,7 +880,7 @@ void fail_tests(void) int main(void) { - plan_tests(419); + plan_tests(423); succeed_tests(); fail_tests(); return exit_status();