diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-10-20 16:07:03 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-10-24 20:35:30 -0400 |
commit | 5e2a2ef288abafa34213982365bf2019e882864e (patch) | |
tree | 55d7321d0114a163d6cb2ddce5bdba75da123036 /tests | |
parent | 73ffa9034f80ff08c30ff519984b5d00894c63c6 (diff) | |
download | glib-5e2a2ef288abafa34213982365bf2019e882864e.tar.gz |
g_parse_debug_string: invert flags given besides "all"
Any flags specified as well as "all" are subtracted from the result,
allowing the user to specify FOO_DEBUG="all,bar,baz" to mean "give me
debugging information for everything except bar and baz".
https://bugzilla.gnome.org/show_bug.cgi?id=642452
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testglib.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/testglib.c b/tests/testglib.c index 35c95730f..1a06d101c 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -509,10 +509,11 @@ find_first_that(gpointer key, static void test_g_parse_debug_string (void) { - GDebugKey keys[3] = { + GDebugKey keys[] = { { "foo", 1 }, { "bar", 2 }, - { "baz", 4 } + { "baz", 4 }, + { "weird", 8 }, }; guint n_keys = G_N_ELEMENTS (keys); guint result; @@ -531,6 +532,19 @@ test_g_parse_debug_string (void) result = g_parse_debug_string ("all", keys, n_keys); g_assert_cmpuint (result, ==, (1 << n_keys) - 1); + + /* Test subtracting debug flags from "all" */ + result = g_parse_debug_string ("all:foo", keys, n_keys); + g_assert_cmpuint (result, ==, 2 | 4 | 8); + + result = g_parse_debug_string ("foo baz,all", keys, n_keys); + g_assert_cmpuint (result, ==, 2 | 8); + + result = g_parse_debug_string ("all,fooo,baz", keys, n_keys); + g_assert_cmpuint (result, ==, 1 | 2 | 8); + + result = g_parse_debug_string ("all:weird", keys, n_keys); + g_assert_cmpuint (result, ==, 1 | 2 | 4); } static void |