summaryrefslogtreecommitdiff
path: root/tests/test-break.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-04-14 13:11:49 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2020-04-14 13:13:51 +0100
commit3fc1a9bff1892f92d96bcf1fb86c157885673396 (patch)
tree209a6db48983052ef79396e09041f13c9f6f7a85 /tests/test-break.c
parent2a773323f1f7b5510ee0de7a1ea0ac8bec0e05d4 (diff)
downloadpango-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-break.c')
-rw-r--r--tests/test-break.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/tests/test-break.c b/tests/test-break.c
index 8549b678..f4faaab3 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -51,12 +51,8 @@ test_file (const gchar *filename, GString *string)
PangoAttrList *attributes;
PangoLayout *layout;
- 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;
@@ -68,12 +64,8 @@ test_file (const gchar *filename, GString *string)
len = g_utf8_strlen (test, -1) + 1;
attrs = g_new (PangoLogAttr, len);
- if (!pango_parse_markup (test, -1, 0, &attributes, &text, NULL, &error))
- {
- fprintf (stderr, "%s\n", error->message);
- g_error_free (error);
- return;
- }
+ pango_parse_markup (test, -1, 0, &attributes, &text, NULL, &error);
+ g_assert_no_error (error);
layout = pango_layout_new (context);
pango_layout_set_text (layout, text, length);
@@ -260,7 +252,8 @@ test_break (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);
}
@@ -291,7 +284,7 @@ main (int argc, char *argv[])
string = g_string_sized_new (0);
test_file (argv[1], string);
- printf ("%s", string->str);
+ g_test_message ("%s", string->str);
return 0;
}