g_option_context_free (context);
}
-static void
-callback_test_optional_9 (void)
-{
- GOptionContext *context;
- gboolean retval;
- GError *error = NULL;
- gchar **argv;
- gchar **argv_copy;
- int argc;
- gchar *string = NULL;
- GOptionEntry entries [] =
- { { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING,
- &string, NULL, NULL },
- { NULL } };
-
- context = g_option_context_new (NULL);
- g_option_context_add_main_entries (context, entries, NULL);
-
- /* Now try parsing */
- argv = split_string ("program -t", &argc);
- argv_copy = copy_stringv (argv, argc);
-
- retval = g_option_context_parse (context, &argc, &argv, &error);
- g_assert_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE);
- g_assert (!retval);
- g_assert (string == NULL);
- check_identical_stringv (argv_copy, argv);
-
- g_error_free (error);
- g_strfreev (argv_copy);
- g_free (argv);
- g_option_context_free (context);
-}
-
-static void
-callback_test_optional_10 (void)
-{
- GOptionContext *context;
- gboolean retval;
- GError *error = NULL;
- gchar **argv;
- gchar **argv_copy;
- int argc;
- gchar *string = NULL;
- GOptionEntry entries [] =
- { { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING,
- &string, NULL, NULL },
- { NULL } };
-
- context = g_option_context_new (NULL);
- g_option_context_add_main_entries (context, entries, NULL);
-
- /* Now try parsing */
- argv = split_string ("program --test", &argc);
- argv_copy = copy_stringv (argv, argc);
-
- retval = g_option_context_parse (context, &argc, &argv, &error);
- g_assert_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE);
- g_assert (!retval);
- g_assert (string == NULL);
- check_identical_stringv (argv_copy, argv);
-
- g_error_free (error);
- g_strfreev (argv_copy);
- g_free (argv);
- g_option_context_free (context);
-}
-
static GPtrArray *callback_remaining_args;
static gboolean
callback_remaining_test1_callback (const gchar *option_name, const gchar *value,