diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-04-14 13:11:49 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-04-14 13:13:51 +0100 |
commit | 3fc1a9bff1892f92d96bcf1fb86c157885673396 (patch) | |
tree | 209a6db48983052ef79396e09041f13c9f6f7a85 /tests/test-itemize.c | |
parent | 2a773323f1f7b5510ee0de7a1ea0ac8bec0e05d4 (diff) | |
download | pango-3fc1a9bff1892f92d96bcf1fb86c157885673396.tar.gz |
tests: Use the appropriate GTest API
Do not use homegrown assertion and failure macros, when GTest has
perfectly functional API to deal with all the cases Pango covers.
Using GTest also allows us to rely on appropriate formatting for
results and logging.
Diffstat (limited to 'tests/test-itemize.c')
-rw-r--r-- | tests/test-itemize.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/test-itemize.c b/tests/test-itemize.c index d66c40d1..167e4e80 100644 --- a/tests/test-itemize.c +++ b/tests/test-itemize.c @@ -118,12 +118,8 @@ test_file (const gchar *filename, GString *string) GList *items, *l; const char *sep = ""; - if (!g_file_get_contents (filename, &contents, &length, &error)) - { - fprintf (stderr, "%s\n", error->message); - g_error_free (error); - return; - } + g_file_get_contents (filename, &contents, &length, &error); + g_assert_no_error (error); test = contents; @@ -131,13 +127,8 @@ test_file (const gchar *filename, GString *string) while (test[0] == '#') test = strchr (test, '\n') + 1; - - if (!pango_parse_markup (test, -1, 0, &attrs, &text, NULL, &error)) - { - fprintf (stderr, "%s\n", error->message); - g_error_free (error); - return; - } + pango_parse_markup (test, -1, 0, &attrs, &text, NULL, &error); + g_assert_no_error (error); s1 = g_string_new ("Items: "); s2 = g_string_new ("Font: "); @@ -257,7 +248,8 @@ test_itemize (gconstpointer d) if (diff && diff[0]) { - g_printerr ("Contents don't match expected contents:\n%s", diff); + g_test_message ("Contents don't match expected contents"); + g_test_message ("%s", diff); g_test_fail (); g_free (diff); } |