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-layout.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-layout.c')
-rw-r--r-- | tests/test-layout.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c index cbbffd2c..2fc78240 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -238,12 +238,8 @@ test_file (const gchar *filename, GString *string) PangoWrapMode wrap = PANGO_WRAP_WORD; PangoFontDescription *desc; - 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); p = strchr (contents, '\n'); g_assert (p); @@ -319,7 +315,8 @@ test_layout (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); } @@ -350,7 +347,7 @@ main (int argc, char *argv[]) string = g_string_sized_new (0); test_file (argv[1], string); - g_print ("%s", string->str); + g_test_message ("%s", string->str); return 0; } |