[pango/more-test-coverage2: 12/15] tests: Make test-break output more convenient




commit d362db397775d1eb2c5740ed9c84f16d027293e4
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jul 6 16:15:15 2021 -0400

    tests: Make test-break output more convenient
    
    Avoid g_test_init if we are just generating expected output,
    for easier updating.

 tests/test-break.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/tests/test-break.c b/tests/test-break.c
index 319805df..b06fb4c0 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -76,7 +76,10 @@ test_file (const gchar *filename, GString *string)
   if (pango_layout_get_unknown_glyphs_count (layout) > 0)
     {
       char *msg = g_strdup_printf ("Missing glyphs - skipping %s. Maybe fonts are missing?", filename);
-      g_test_skip (msg);
+      if (g_test_initialized())
+        g_test_skip (msg);
+      else
+        g_warning ("%s", msg);
       g_free (msg);
       g_free (contents);
       g_object_unref (layout);
@@ -328,8 +331,6 @@ main (int argc, char *argv[])
   const gchar *name;
   gchar *path;
 
-  g_test_init (&argc, &argv, NULL);
-
   setlocale (LC_ALL, "");
 
   context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
@@ -349,8 +350,9 @@ main (int argc, char *argv[])
                    " x - expandable space    b - sentence boundary\n"
                    " w - whitespace          s - sentence start\n"
                    "                         e - sentence end\n");
+          return 0;
         }
-      else
+      else if (argv[1][0] != '-')
         {
           GString *string;
 
@@ -359,11 +361,13 @@ main (int argc, char *argv[])
           g_print ("%s", string->str);
 
           g_string_free (string, TRUE);
-        }
 
-      return 0;
+          return 0;
+        }
     }
 
+  g_test_init (&argc, &argv, NULL);
+
   path = g_test_build_filename (G_TEST_DIST, "breaks", NULL);
   dir = g_dir_open (path, 0, &error);
   g_free (path);


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