diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-06-08 17:52:56 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-06-08 17:52:56 +0100 |
commit | c3de8bca2d084e90a77d50db40447f145520e4f5 (patch) | |
tree | 159128cc1d535a1fafe1d3b150197c27f905ee76 | |
parent | 984ed4597d51a1f81f6bb9006dc503901cc6401a (diff) | |
download | pango-c3de8bca2d084e90a77d50db40447f145520e4f5.tar.gz |
tests: Ensure we respect the TAP output format
When dumping the diff between the computed and expected results, we need
to respect the TAP format and place "#" in front of each line.
-rw-r--r-- | tests/test-break.c | 15 | ||||
-rw-r--r-- | tests/test-itemize.c | 15 | ||||
-rw-r--r-- | tests/test-layout.c | 14 |
3 files changed, 35 insertions, 9 deletions
diff --git a/tests/test-break.c b/tests/test-break.c index e92cbe8e..cdb7e6c0 100644 --- a/tests/test-break.c +++ b/tests/test-break.c @@ -260,18 +260,27 @@ test_break (gconstpointer d) diff = diff_with_file (expected_file, dump->str, dump->len, &error); g_assert_no_error (error); + setlocale (LC_ALL, old_locale); + if (diff && diff[0]) { + char **lines = g_strsplit (diff, "\n", -1); + const char *line; + int i = 0; + g_test_message ("Contents don't match expected contents"); - g_test_message ("%s", diff); + + for (line = lines[0]; line != NULL; line = lines[++i]) + g_test_message ("%s", line); + g_test_fail (); + + g_strfreev (lines); g_free (diff); } g_string_free (dump, TRUE); g_free (expected_file); - - setlocale (LC_ALL, old_locale); } int diff --git a/tests/test-itemize.c b/tests/test-itemize.c index 51f2bb9c..1709b834 100644 --- a/tests/test-itemize.c +++ b/tests/test-itemize.c @@ -256,18 +256,27 @@ test_itemize (gconstpointer d) diff = diff_with_file (expected_file, dump->str, dump->len, &error); g_assert_no_error (error); + setlocale (LC_ALL, old_locale); + if (diff && diff[0]) { + char **lines = g_strsplit (diff, "\n", -1); + const char *line; + int i = 0; + g_test_message ("Contents don't match expected contents"); - g_test_message ("%s", diff); + + for (line = lines[0]; line != NULL; line = lines[++i]) + g_test_message ("%s", line); + g_test_fail (); + + g_strfreev (lines); g_free (diff); } g_string_free (dump, TRUE); g_free (expected_file); - - setlocale (LC_ALL, old_locale); } int diff --git a/tests/test-layout.c b/tests/test-layout.c index 9661457b..623b7a70 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -323,18 +323,26 @@ test_layout (gconstpointer d) diff = diff_with_file (expected_file, dump->str, dump->len, &error); g_assert_no_error (error); + setlocale (LC_ALL, old_locale); + if (diff && diff[0]) { + char **lines = g_strsplit (diff, "\n", -1); + const char *line; + int i = 0; + g_test_message ("Contents don't match expected contents"); - g_test_message ("%s", diff); + + for (line = lines[0]; line != NULL; line = lines[++i]) + g_test_message ("%s", line); + g_test_fail (); + g_strfreev (lines); g_free (diff); } g_string_free (dump, TRUE); g_free (expected_file); - - setlocale (LC_ALL, old_locale); } int |