X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fopt%2Ftest%2Frun-correct-reporting.c;h=8534f291ac3e9accfeafb0685fc61286b6adf4b6;hp=b51d53eb3faff7f0745db3514ac1764ed65adca1;hb=4f09cf20ca00fe38b0702e0556bbad2341595ed0;hpb=7e381e6c241957ff5840b1d8a0ab5f3bde6337c2 diff --git a/ccan/opt/test/run-correct-reporting.c b/ccan/opt/test/run-correct-reporting.c index b51d53eb..8534f291 100644 --- a/ccan/opt/test/run-correct-reporting.c +++ b/ccan/opt/test/run-correct-reporting.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "utils.h" int main(int argc, char *argv[]) @@ -14,33 +15,35 @@ int main(int argc, char *argv[]) /* --aaa without args. */ opt_register_arg("-a|--aaa", test_arg, NULL, "aaa", ""); ok1(!parse_args(&argc, &argv, "--aaa", NULL)); - ok1(strstr(err_output, ": --aaa: option requires an argument")); + ok1(strstr(err_output, ": --aaa: requires an argument")); free(err_output); err_output = NULL; ok1(!parse_args(&argc, &argv, "-a", NULL)); - ok1(strstr(err_output, ": -a: option requires an argument")); + ok1(strstr(err_output, ": -a: requires an argument")); free(err_output); err_output = NULL; /* Multiple */ opt_register_arg("--bbb|-b|-c|--ccc", test_arg, NULL, "aaa", ""); ok1(!parse_args(&argc, &argv, "--bbb", NULL)); - ok1(strstr(err_output, ": --bbb: option requires an argument")); + ok1(strstr(err_output, ": --bbb: requires an argument")); free(err_output); err_output = NULL; ok1(!parse_args(&argc, &argv, "-b", NULL)); - ok1(strstr(err_output, ": -b: option requires an argument")); + ok1(strstr(err_output, ": -b: requires an argument")); free(err_output); err_output = NULL; ok1(!parse_args(&argc, &argv, "-c", NULL)); - ok1(strstr(err_output, ": -c: option requires an argument")); + ok1(strstr(err_output, ": -c: requires an argument")); free(err_output); err_output = NULL; ok1(!parse_args(&argc, &argv, "--ccc", NULL)); - ok1(strstr(err_output, ": --ccc: option requires an argument")); + ok1(strstr(err_output, ": --ccc: requires an argument")); free(err_output); err_output = NULL; + /* parse_args allocates argv */ + free(argv); return exit_status(); }