[gtksourceview/wip/chergert/vim: 322/363] make text failures more readable




commit a08e84f4a9fdf6f956da3ed93fa76a746f467c38
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 5 15:17:59 2021 -0700

    make text failures more readable

 testsuite/test-vim-text-object.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/testsuite/test-vim-text-object.c b/testsuite/test-vim-text-object.c
index aee3422d..17d55539 100644
--- a/testsuite/test-vim-text-object.c
+++ b/testsuite/test-vim-text-object.c
@@ -44,16 +44,28 @@ run_test (GtkSourceVimState *text_object,
 
        if (!gtk_source_vim_text_object_select (GTK_SOURCE_VIM_TEXT_OBJECT (text_object), &begin, &end))
        {
+               char *text_escape;
+               char *exp_escape;
+
                if (expect_selection == NULL)
                        goto cleanup;
-               g_error ("Failed to select text-object\n\n'''%s'''\npotiion: %u\nepxecting: '''%s'''",
-                        text, position, expect_selection);
+
+               text_escape = g_strescape (text, NULL);
+               exp_escape = g_strescape (expect_selection, NULL);
+
+               g_error ("Selection Failed: '%s' at position %u expected '%s'",
+                        text_escape, position, exp_escape);
+
+               g_free (text_escape);
+               g_free (exp_escape);
        }
 
        if (expect_selection == NULL)
        {
                char *out = gtk_text_iter_get_slice (&begin, &end);
-               g_error ("Expected to fail selection but got '''%s'''", out);
+               char *escaped = g_strescape (out, NULL);
+               g_error ("Expected to fail selection but got '%s'", escaped);
+               g_free (escaped);
                g_free (out);
        }
        else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]