[gtk+/parser: 74/79] tests: Make the parser fail manually when all tests run as expected



commit f8992d8d46f3bb7a1e3b4af8dc0b3c3cedaccc09
Author: Benjamin Otte <otte redhat com>
Date:   Thu Apr 14 13:48:06 2011 +0200

    tests: Make the parser fail manually when all tests run as expected
    
    This way, the testsuite doesn't stop in between, but actually finishes.

 tests/css/parser/test-css-parser.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/tests/css/parser/test-css-parser.c b/tests/css/parser/test-css-parser.c
index 8ca86fb..38c7553 100644
--- a/tests/css/parser/test-css-parser.c
+++ b/tests/css/parser/test-css-parser.c
@@ -26,6 +26,8 @@
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
 
+static guint failures = 0;
+
 static char *
 test_get_reference_file (const char *css_file)
 {
@@ -170,6 +172,7 @@ test_css_file (GFile *file)
   char *css_file, *reference_file, *errors_file;
   GString *errors;
   GError *error = NULL;
+  gboolean success = TRUE;
 
   css_file = g_file_get_path (file);
   errors = g_string_new ("");
@@ -193,7 +196,7 @@ test_css_file (GFile *file)
   if (diff && diff[0])
     {
       g_test_message ("%s", diff);
-      g_assert_not_reached ();
+      success = FALSE;
     }
 
   g_free (css);
@@ -209,13 +212,13 @@ test_css_file (GFile *file)
       if (diff && diff[0])
         {
           g_test_message ("%s", diff);
-          g_assert_not_reached ();
+          success = FALSE;
         }
     }
   else if (errors->str[0])
     {
       g_test_message ("Unexpected errors:\n%s", errors->str);
-      g_assert_not_reached ();
+      success = FALSE;
     }
 
   g_free (errors_file);
@@ -223,6 +226,12 @@ test_css_file (GFile *file)
 
   g_free (diff);
   g_free (css_file);
+  
+  if (!success)
+    {
+      failures++;
+      g_print ("NOT ");
+    }
 }
 
 static void
@@ -420,6 +429,6 @@ main (int argc, char **argv)
         }
     }
 
-  return g_test_run ();
+  return g_test_run () + failures;
 }
 



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