]> git.ozlabs.org Git - ccan/commitdiff
ccan: add test that second arg in multiple arg string is correctly reported.
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 29 Apr 2023 06:11:13 +0000 (15:41 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 20 Jun 2023 03:08:36 +0000 (12:38 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/opt/test/run-correct-reporting.c

index 8534f291ac3e9accfeafb0685fc61286b6adf4b6..0c4f6c8693972b489440feddd1a38b260a8011f9 100644 (file)
@@ -10,7 +10,7 @@
 
 int main(int argc, char *argv[])
 {
-       plan_tests(12);
+       plan_tests(14);
 
        /* --aaa without args. */
        opt_register_arg("-a|--aaa", test_arg, NULL, "aaa", "");
@@ -42,6 +42,10 @@ int main(int argc, char *argv[])
        free(err_output);
        err_output = NULL;
 
+       opt_register_noarg("-d", test_noarg, NULL, "");
+       ok1(!parse_args(&argc, &argv, "-dc", NULL));
+       ok1(strstr(err_output, ": -c: requires an argument"));
+
        /* parse_args allocates argv */
        free(argv);
        return exit_status();