[glib] gobject/tests: use g_test_expect_messages()
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gobject/tests: use g_test_expect_messages()
- Date: Mon, 3 Sep 2012 12:56:35 +0000 (UTC)
commit e0cba35d4116c61035a0cbb403d89a04bbdb8963
Author: Dan Winship <danw gnome org>
Date: Mon Aug 27 07:45:08 2012 -0400
gobject/tests: use g_test_expect_messages()
https://bugzilla.gnome.org/show_bug.cgi?id=682560
gobject/tests/Makefile.am | 3 +++
gobject/tests/ifaceproperties.c | 16 +++++++---------
gobject/tests/param.c | 17 ++++++++---------
3 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/gobject/tests/Makefile.am b/gobject/tests/Makefile.am
index fcc7b84..3100c2f 100644
--- a/gobject/tests/Makefile.am
+++ b/gobject/tests/Makefile.am
@@ -1,5 +1,8 @@
include $(top_srcdir)/Makefile.decl
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"GLib-GObject\"
+
INCLUDES = -g $(gobject_INCLUDES) $(GLIB_DEBUG_FLAGS)
if CROSS_COMPILING
diff --git a/gobject/tests/ifaceproperties.c b/gobject/tests/ifaceproperties.c
index f7a260c..c86a23b 100644
--- a/gobject/tests/ifaceproperties.c
+++ b/gobject/tests/ifaceproperties.c
@@ -615,21 +615,19 @@ base2_object_init (Base2Object *object)
static void
test_not_overridden (void)
{
+ Base2Object *object;
+
if (!g_test_undefined ())
return;
g_test_bug ("637738");
- if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT|G_TEST_TRAP_SILENCE_STDERR))
- {
- Base2Object *object;
+ g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
+ "*Base2Object doesn't implement property 'prop3' from interface 'TestIface'*");
+ object = g_object_new (BASE2_TYPE_OBJECT, NULL);
+ g_test_assert_expected_messages ();
- object = g_object_new (BASE2_TYPE_OBJECT, NULL);
- g_object_unref (object);
- exit (0);
- }
- g_test_trap_assert_failed ();
- g_test_trap_assert_stderr ("*Base2Object doesn't implement property 'prop3' from interface 'TestIface'*");
+ g_object_unref (object);
}
int
diff --git a/gobject/tests/param.c b/gobject/tests/param.c
index 671642e..ac401f3 100644
--- a/gobject/tests/param.c
+++ b/gobject/tests/param.c
@@ -482,15 +482,14 @@ test_interface_default_init (TestInterfaceInterface *iface)
continue;
/* we think that this is impossible. make sure. */
- if (g_test_trap_fork (G_TIME_SPAN_SECOND, G_TEST_TRAP_SILENCE_STDERR))
- {
- GParamSpec *pspec;
+ pspec = g_param_spec_object ("xyz", "xyz", "xyz", types[i], j);
- pspec = g_param_spec_object ("xyz", "xyz", "xyz", types[i], j);
- g_object_interface_install_property (iface, pspec);
- exit (0);
- }
- g_test_trap_assert_failed ();
+ g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
+ "*assertion*pspec->flags*failed*");
+ g_object_interface_install_property (iface, pspec);
+ g_test_assert_expected_messages ();
+
+ g_param_spec_unref (pspec);
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]