* lib: add mu_str_parse_arglist + unit tests
This commit is contained in:
@ -129,6 +129,30 @@ test_mu_str_flatten (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_parse_arglist (void)
|
||||
{
|
||||
const char *args;
|
||||
GHashTable *hash;
|
||||
GError *err;
|
||||
|
||||
args = "cmd:find query:\"maildir:\\\"/sent items\\\"\" maxnum:500";
|
||||
|
||||
err = NULL;
|
||||
hash = mu_str_parse_arglist (args, &err);
|
||||
g_assert_no_error (err);
|
||||
g_assert (hash);
|
||||
|
||||
g_assert_cmpstr (g_hash_table_lookup (hash, "cmd"), ==,
|
||||
"find");
|
||||
g_assert_cmpstr (g_hash_table_lookup (hash, "query"), ==,
|
||||
"maildir:\"/sent items\"");
|
||||
g_assert_cmpstr (g_hash_table_lookup (hash, "maxnum"), ==,
|
||||
"500");
|
||||
|
||||
g_hash_table_destroy (hash);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
@ -403,9 +427,6 @@ test_mu_term_fixups (void)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@ -443,6 +464,9 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/mu-str/mu-str-to-list-strip",
|
||||
test_mu_str_to_list_strip);
|
||||
|
||||
g_test_add_func ("/mu-str/mu-str-esc-to-list",
|
||||
test_parse_arglist);
|
||||
|
||||
g_test_add_func ("/mu-str/mu-str-esc-to-list",
|
||||
test_mu_str_esc_to_list);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user