[gtksourceview] testsuite: give language id on test failure
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] testsuite: give language id on test failure
- Date: Fri, 24 Jun 2022 19:00:14 +0000 (UTC)
commit 1ac454bf8886087bd6aa546e031de425331140e7
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 24 11:59:03 2022 -0700
testsuite: give language id on test failure
If we discover a language and expected NULL, it is handy to see what
language failed from the CI runner so that we can easily point to it
from merge requests.
testsuite/test-languagemanager.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/testsuite/test-languagemanager.c b/testsuite/test-languagemanager.c
index 85c4d178..1d335eea 100644
--- a/testsuite/test-languagemanager.c
+++ b/testsuite/test-languagemanager.c
@@ -123,6 +123,14 @@ test_guess_language_empty_empty (void)
gtk_source_language_manager_guess_language (lm, "", "");
}
+static inline void
+assert_null_language (GtkSourceLanguage *l)
+{
+ if (l != NULL)
+ g_error ("Expected NULL language, got %s",
+ gtk_source_language_get_id (l));
+}
+
static void
test_guess_language (void)
{
@@ -144,16 +152,16 @@ test_guess_language (void)
g_test_trap_assert_failed ();
l = gtk_source_language_manager_guess_language (lm, "foo.abcdef", NULL);
- g_assert_null (l);
+ assert_null_language (l);
l = gtk_source_language_manager_guess_language (lm, "foo.abcdef", "");
- g_assert_null (l);
+ assert_null_language (l);
l = gtk_source_language_manager_guess_language (lm, NULL, "image/png");
- g_assert_null (l);
+ assert_null_language (l);
l = gtk_source_language_manager_guess_language (lm, "", "image/png");
- g_assert_null (l);
+ assert_null_language (l);
l = gtk_source_language_manager_guess_language (lm, "foo.c", NULL);
g_assert_cmpstr (gtk_source_language_get_id (l), ==, "c");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]