[glib] testutils: Return number of bad tests from g_test_run_suite_internal()



commit d259d50afd7b1f0f063e9ad95f5784540bd0378c
Author: Benjamin Otte <otte redhat com>
Date:   Mon Apr 18 14:41:51 2011 +0200

    testutils: Return number of bad tests from g_test_run_suite_internal()
    
    In particular do not return a boolean disguised as an int.

 glib/gtestutils.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 9ddad88..2f825a7 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -1202,7 +1202,7 @@ static int
 g_test_run_suite_internal (GTestSuite *suite,
                            const char *path)
 {
-  guint n_bad = 0, bad_suite = 0, l;
+  guint n_bad = 0, l;
   gchar *rest, *old_name = test_run_name;
   GSList *slist, *reversed;
   g_return_val_if_fail (suite != NULL, -1);
@@ -1230,12 +1230,12 @@ g_test_run_suite_internal (GTestSuite *suite,
       GTestSuite *ts = slist->data;
       guint n = l ? strlen (ts->name) : 0;
       if (l == n && strncmp (path, ts->name, n) == 0)
-        bad_suite += g_test_run_suite_internal (ts, rest ? rest : "") != 0;
+        n_bad += g_test_run_suite_internal (ts, rest ? rest : "");
     }
   g_slist_free (reversed);
   g_free (test_run_name);
   test_run_name = old_name;
-  return n_bad || bad_suite;
+  return n_bad;
 }
 
 /**
@@ -1271,7 +1271,7 @@ g_test_run_suite (GTestSuite *suite)
         path++;
       if (!n) /* root suite, run unconditionally */
         {
-          n_bad += 0 != g_test_run_suite_internal (suite, path);
+          n_bad += g_test_run_suite_internal (suite, path);
           continue;
         }
       /* regular suite, match path */
@@ -1279,7 +1279,7 @@ g_test_run_suite (GTestSuite *suite)
       l = strlen (path);
       l = rest ? MIN (l, rest - path) : l;
       if ((!l || l == n) && strncmp (path, suite->name, n) == 0)
-        n_bad += 0 != g_test_run_suite_internal (suite, rest ? rest : "");
+        n_bad += g_test_run_suite_internal (suite, rest ? rest : "");
     }
   return n_bad;
 }



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