[libpeas] Assert if not all the log hooks were popped



commit c13f944dc77656c630cff3a7b75509d3874ea8a5
Author: Garrett Regier <garrettregier gmail com>
Date:   Mon Jul 18 03:47:43 2011 -0700

    Assert if not all the log hooks were popped
    
    This can happen when you have a test that does not use
    testing_util_engine_free() and forgets to pop the hooks.

 tests/testing-util/testing-util.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/tests/testing-util/testing-util.c b/tests/testing-util/testing-util.c
index 16bb221..f8b8ee7 100644
--- a/tests/testing-util/testing-util.c
+++ b/tests/testing-util/testing-util.c
@@ -201,7 +201,11 @@ testing_util_run_tests (void)
 
   retval = g_test_run ();
 
-  g_ptr_array_unref (log_hooks);
+  if (log_hooks != NULL)
+    {
+      g_assert_cmpuint (log_hooks->len, ==, 0);
+      g_ptr_array_unref (log_hooks);
+    }
 
   /* Cannot call this with atexit() because
    * gcov does not register that it was called.



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