[gnome-builder] tests: log more information on parsed snippets



commit 3fba175316b84a4415d8ee5040ff00e0c36275b5
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 8 15:12:40 2016 -0800

    tests: log more information on parsed snippets
    
    This can be useful when testing the parsing of a snippet.

 tests/test-snippet-parser.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-snippet-parser.c b/tests/test-snippet-parser.c
index 29a63d0..9c09467 100644
--- a/tests/test-snippet-parser.c
+++ b/tests/test-snippet-parser.c
@@ -44,6 +44,31 @@ main (gint   argc,
           g_printerr ("%s\n", error->message);
           return EXIT_FAILURE;
         }
+
+      {
+        for (GList *iter = ide_source_snippet_parser_get_snippets (parser);
+             iter != NULL;
+             iter = iter->next)
+          {
+            IdeSourceSnippet *snippet = iter->data;
+
+            g_print ("=====================================\n");
+            g_print ("Snippet: %s with language %s\n",
+                     ide_source_snippet_get_trigger (snippet),
+                     ide_source_snippet_get_language (snippet));
+
+            for (guint j = 0; j < ide_source_snippet_get_n_chunks (snippet); j++)
+              {
+                IdeSourceSnippetChunk *chunk = ide_source_snippet_get_nth_chunk (snippet, j);
+                gint tab_stop = ide_source_snippet_chunk_get_tab_stop (chunk);
+
+                if (tab_stop > 0)
+                  g_print ("TAB STOP %02d (%02d): %s\n", tab_stop, j, ide_source_snippet_chunk_get_spec 
(chunk));
+                else
+                  g_print ("TEXT        (%02d): %s\n", j, ide_source_snippet_chunk_get_spec (chunk));
+              }
+          }
+      }
     }
 
   g_option_context_free (context);


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