mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 21:46:22 +00:00
Check for duplicate options in option parser
This commit is contained in:
@@ -666,5 +666,25 @@ parse_options_when_unknown_opt_sets_error(void **state)
|
||||
assert_null(options);
|
||||
assert_false(res);
|
||||
|
||||
options_destroy(options);
|
||||
}
|
||||
|
||||
void
|
||||
parse_options_with_duplicated_option_sets_error(void **state)
|
||||
{
|
||||
gchar *args[] = { "cmd1", "cmd2", "opt1", "val1", "opt2", "val2", "opt1", "val3", NULL };
|
||||
|
||||
GList *keys = NULL;
|
||||
keys = g_list_append(keys, "opt1");
|
||||
keys = g_list_append(keys, "opt2");
|
||||
keys = g_list_append(keys, "opt3");
|
||||
|
||||
gboolean res = TRUE;
|
||||
|
||||
GHashTable *options = parse_options(args, 2, keys, &res);
|
||||
|
||||
assert_null(options);
|
||||
assert_false(res);
|
||||
|
||||
options_destroy(options);
|
||||
}
|
||||
Reference in New Issue
Block a user