From 322f249409838d2547449ce0ee8b479242ce2136 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 29 Apr 2023 15:41:13 +0930 Subject: [PATCH] ccan: add test that second arg in multiple arg string is correctly reported. Signed-off-by: Rusty Russell --- ccan/opt/test/run-correct-reporting.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ccan/opt/test/run-correct-reporting.c b/ccan/opt/test/run-correct-reporting.c index 8534f291..0c4f6c86 100644 --- a/ccan/opt/test/run-correct-reporting.c +++ b/ccan/opt/test/run-correct-reporting.c @@ -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(); -- 2.39.2