conformance: Use g_assert_no_error() if available

GLib 2.20 has a nice g_assert() wrapper which will print out the GError
if it's not NULL.
This commit is contained in:
Emmanuele Bassi 2010-03-02 19:09:20 +00:00
parent 048fcea988
commit 2f68949962
3 changed files with 50 additions and 0 deletions

View File

@ -18,7 +18,12 @@ test_animator_multi_properties (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
foo = clutter_script_get_object (script, "foo"); foo = clutter_script_get_object (script, "foo");
g_assert (G_IS_OBJECT (foo)); g_assert (G_IS_OBJECT (foo));
@ -116,7 +121,12 @@ test_animator_properties (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
animator = clutter_script_get_object (script, "animator"); animator = clutter_script_get_object (script, "animator");
g_assert (CLUTTER_IS_ANIMATOR (animator)); g_assert (CLUTTER_IS_ANIMATOR (animator));
@ -172,7 +182,12 @@ test_animator_base (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
animator = clutter_script_get_object (script, "animator"); animator = clutter_script_get_object (script, "animator");
g_assert (CLUTTER_IS_ANIMATOR (animator)); g_assert (CLUTTER_IS_ANIMATOR (animator));

View File

@ -351,7 +351,12 @@ test_list_model_from_script (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif /* GLIB_CHECK_VERSION (2, 20, 0) */
model = clutter_script_get_object (script, "test-model"); model = clutter_script_get_object (script, "test-model");

View File

@ -129,7 +129,12 @@ test_script_child (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
container = actor = NULL; container = actor = NULL;
clutter_script_get_objects (script, clutter_script_get_objects (script,
@ -176,7 +181,12 @@ test_script_single (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
actor = clutter_script_get_object (script, "test"); actor = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_RECTANGLE (actor)); g_assert (CLUTTER_IS_RECTANGLE (actor));
@ -211,7 +221,12 @@ test_script_implicit_alpha (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
behaviour = clutter_script_get_object (script, "test"); behaviour = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_BEHAVIOUR (behaviour)); g_assert (CLUTTER_IS_BEHAVIOUR (behaviour));
@ -244,7 +259,12 @@ test_script_object_property (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
actor = clutter_script_get_object (script, "test"); actor = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_BOX (actor)); g_assert (CLUTTER_IS_BOX (actor));
@ -271,7 +291,12 @@ test_script_named_object (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
actor = clutter_script_get_object (script, "test"); actor = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_BOX (actor)); g_assert (CLUTTER_IS_BOX (actor));
@ -298,7 +323,12 @@ test_script_animation (TestConformSimpleFixture *fixture,
clutter_script_load_from_file (script, test_file, &error); clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error) if (g_test_verbose () && error)
g_print ("Error: %s", error->message); g_print ("Error: %s", error->message);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL); g_assert (error == NULL);
#endif
animation = clutter_script_get_object (script, "test"); animation = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_ANIMATION (animation)); g_assert (CLUTTER_IS_ANIMATION (animation));