From e55b4394a4942a96b5028eb8c22de6c58229b783 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Sep 2011 17:42:44 +0100 Subject: [PATCH 10/10] Move use of 0 as an error domain into the invalid-usage test I think this is invalid, although others might disagree. Signed-off-by: Simon McVittie Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40151 --- test/core/error-mapping.c | 26 -------------------------- test/manual/invalid-usage.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/test/core/error-mapping.c b/test/core/error-mapping.c index eafef01..122b6de 100644 --- a/test/core/error-mapping.c +++ b/test/core/error-mapping.c @@ -248,30 +248,6 @@ test_unregistered (Fixture *f, } static void -test_nonsensical (Fixture *f, - gconstpointer context) -{ - /* This throws an error with domain 0 and code 0, which makes no sense. - * It's programmer error, really: g_error_new() would critical if given - * the same domain and code. See GNOME#660371. - * - * This was added for fd.o #27799, but there's a difference between - * "this is an error domain, but not one registered with dbus-glib" and - * "this isn't even an error domain". */ - g_test_bug ("27799"); - - if (!org_freedesktop_DBus_GLib_Tests_MyObject_throw_unregistered_error_async ( - f->proxy, throw_error_cb, f)) - g_error ("Failed to start async ThrowUnregisteredError call"); - - while (f->error == NULL) - g_main_context_iteration (NULL, TRUE); - - g_assert_error (f->error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION); - assert_contains (f->error->message, "this method always loses more"); -} - -static void teardown (Fixture *f, gconstpointer context G_GNUC_UNUSED) { @@ -314,8 +290,6 @@ main (int argc, teardown); g_test_add ("/error-mapping/multi-word", Fixture, NULL, setup, test_multi_word, teardown); - g_test_add ("/error-mapping/nonsensical", Fixture, NULL, setup, - test_nonsensical, teardown); g_test_add ("/error-mapping/simple", Fixture, NULL, setup, test_simple, teardown); g_test_add ("/error-mapping/underscore", Fixture, NULL, setup, diff --git a/test/manual/invalid-usage.c b/test/manual/invalid-usage.c index 59a8314..95a2591 100644 --- a/test/manual/invalid-usage.c +++ b/test/manual/invalid-usage.c @@ -234,6 +234,29 @@ test_error_out_of_range (Fixture *f, } static void +test_error_domain_0 (Fixture *f, + gconstpointer context) +{ + /* This throws an error with domain 0 and code 0, which makes no sense. + * It's programmer error, really: g_error_new() would critical if given + * the same domain and code. See GNOME#660371. + * + * This was added for fd.o #27799, but there's a difference between + * "this is an error domain, but not one registered with dbus-glib" and + * "this isn't even an error domain". */ + g_test_bug ("27799"); + + if (!org_freedesktop_DBus_GLib_Tests_MyObject_throw_unregistered_error_async ( + f->proxy_for_self, throw_error_cb, f)) + g_error ("Failed to start async ThrowUnregisteredError call"); + + while (f->error == NULL) + g_main_context_iteration (NULL, TRUE); + + g_assert_error (f->error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION); +} + +static void teardown (Fixture *f, gconstpointer context G_GNUC_UNUSED) { @@ -290,6 +313,8 @@ main (int argc, teardown); g_test_add ("/invalid/error/out-of-range", Fixture, NULL, setup, test_error_out_of_range, teardown); + g_test_add ("/invalid/error/domain-0", Fixture, NULL, setup, + test_error_domain_0, teardown); return g_test_run (); } -- 1.7.6.3