projects
/
platform
/
upstream
/
glib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6214977
)
Improve GOptionContext test coverage
author
Matthias Clasen
<mclasen@redhat.com>
Mon, 23 Apr 2012 12:16:23 +0000
(08:16 -0400)
committer
Matthias Clasen
<mclasen@redhat.com>
Mon, 23 Apr 2012 12:20:21 +0000
(08:20 -0400)
glib/tests/option-context.c
patch
|
blob
|
history
diff --git
a/glib/tests/option-context.c
b/glib/tests/option-context.c
index
5b839d9
..
d669c12
100644
(file)
--- a/
glib/tests/option-context.c
+++ b/
glib/tests/option-context.c
@@
-1938,14
+1938,25
@@
test_basic (void)
}
static void
}
static void
+set_bool (gpointer data)
+{
+ gboolean *b = data;
+
+ *b = TRUE;
+}
+
+static void
test_main_group (void)
{
GOptionContext *context;
GOptionGroup *group;
test_main_group (void)
{
GOptionContext *context;
GOptionGroup *group;
+ gboolean b = FALSE;
context = g_option_context_new (NULL);
g_assert (g_option_context_get_main_group (context) == NULL);
context = g_option_context_new (NULL);
g_assert (g_option_context_get_main_group (context) == NULL);
- group = g_option_group_new ("name", "description", "hlep", NULL, NULL);
+ group = g_option_group_new ("name", "description", "hlep", &b, set_bool);
+ g_option_context_add_group (context, group);
+ group = g_option_group_new ("name2", "description", "hlep", NULL, NULL);
g_option_context_add_group (context, group);
g_assert (g_option_context_get_main_group (context) == NULL);
group = g_option_group_new ("name", "description", "hlep", NULL, NULL);
g_option_context_add_group (context, group);
g_assert (g_option_context_get_main_group (context) == NULL);
group = g_option_group_new ("name", "description", "hlep", NULL, NULL);
@@
-1953,6
+1964,8
@@
test_main_group (void)
g_assert (g_option_context_get_main_group (context) == group);
g_option_context_free (context);
g_assert (g_option_context_get_main_group (context) == group);
g_option_context_free (context);
+
+ g_assert (b);
}
static gboolean error_func_called = FALSE;
}
static gboolean error_func_called = FALSE;