From 895ea654581ef9928e554366fbd93f613a049017 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 24 Nov 2024 08:29:37 -0800 Subject: option parser: test for no clustering support --- src/supplemental/util/options_test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/supplemental/util/options_test.c b/src/supplemental/util/options_test.c index e365f97e..036f2940 100644 --- a/src/supplemental/util/options_test.c +++ b/src/supplemental/util/options_test.c @@ -302,6 +302,26 @@ test_missing_arg(void) NUTS_FAIL(nng_opts_parse(ac, av, spec, &v, &a, &opti), NNG_ENOARG); } +void +test_no_clustering(void) +{ + int opti = 1; + char *av[2]; + int ac = 2; + int v; + char *a = NULL; + + nng_optspec spec[] = { + { "flag", 'f', 1, false }, + { "verbose", 'v', 2, false }, + { NULL, 0, 0, false }, + }; + + av[0] = "program"; + av[1] = "-fv"; + NUTS_FAIL(nng_opts_parse(ac, av, spec, &v, &a, &opti), NNG_EINVAL); +} + NUTS_TESTS = { { "simple options", test_simple_options }, { "long options", test_long_options }, @@ -316,5 +336,6 @@ NUTS_TESTS = { { "options mixed long short", test_mixed_long_short }, { "ambiguous options", test_ambiguous }, { "missing argument", test_missing_arg }, + { "no clustering", test_no_clustering }, { NULL, NULL }, }; -- cgit v1.2.3-70-g09d2