[libpeas] Clean up the macros used for extension tests



commit bffbb475a6a44fb7ed2f37a5218c532028250d08
Author: Garrett Regier <alias301 gmail com>
Date:   Mon Mar 7 22:37:57 2011 -0800

    Clean up the macros used for extension tests

 tests/libpeas/extension-c.c               |    6 ++--
 tests/libpeas/extension-python.c          |   11 +++++----
 tests/libpeas/extension-seed.c            |   34 +++++++++++++---------------
 tests/libpeas/testing/testing-extension.h |   16 ++++++------
 4 files changed, 33 insertions(+), 34 deletions(-)
---
diff --git a/tests/libpeas/extension-c.c b/tests/libpeas/extension-c.c
index 64b3cad..776ccb9 100644
--- a/tests/libpeas/extension-c.c
+++ b/tests/libpeas/extension-c.c
@@ -27,7 +27,7 @@
 #include "introspection/introspection-callable.h"
 
 static void
-extension_c_instance_refcount (PeasEngine *engine)
+test_extension_c_instance_refcount (PeasEngine *engine)
 {
   PeasPluginInfo *info;
   PeasExtension *extension;
@@ -62,9 +62,9 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
   g_type_init ();
 
-  EXTENSION_TESTS ("c");
+  EXTENSION_TESTS (c);
 
-  EXTENSION_TEST_ADD ("c", "instance-refcount", extension_c_instance_refcount);
+  EXTENSION_TEST (c, "instance-refcount", instance_refcount);
 
   return testing_run_tests ();
 }
diff --git a/tests/libpeas/extension-python.c b/tests/libpeas/extension-python.c
index f2ddd92..ca3d94e 100644
--- a/tests/libpeas/extension-python.c
+++ b/tests/libpeas/extension-python.c
@@ -30,7 +30,7 @@
 #include <pygobject.h>
 
 static void
-extension_python_instance_refcount (PeasEngine *engine)
+test_extension_python_instance_refcount (PeasEngine *engine)
 {
   PeasPluginInfo *info;
   PeasExtension *extension;
@@ -60,7 +60,7 @@ extension_python_instance_refcount (PeasEngine *engine)
 }
 
 static void
-extension_python_activatable_subject_refcount (PeasEngine *engine)
+test_extension_python_activatable_subject_refcount (PeasEngine *engine)
 {
   PeasPluginInfo *info;
   PeasExtension *extension;
@@ -81,6 +81,7 @@ extension_python_activatable_subject_refcount (PeasEngine *engine)
                                             PEAS_TYPE_ACTIVATABLE,
                                             "object", object,
                                             NULL);
+
   g_assert (PEAS_IS_EXTENSION (extension));
 
   /* The python wrapper created around our dummy object should have increased
@@ -107,10 +108,10 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
   g_type_init ();
 
-  EXTENSION_TESTS ("python");
+  EXTENSION_TESTS (python);
 
-  EXTENSION_TEST_ADD ("python", "instance-refcount", extension_python_instance_refcount);
-  EXTENSION_TEST_ADD ("python", "activatable-subject-refcount", extension_python_activatable_subject_refcount);
+  EXTENSION_TEST (python, "instance-refcount", instance_refcount);
+  EXTENSION_TEST (python, "activatable-subject-refcount", activatable_subject_refcount);
 
   return testing_run_tests ();
 }
diff --git a/tests/libpeas/extension-seed.c b/tests/libpeas/extension-seed.c
index 1288425..96d7493 100644
--- a/tests/libpeas/extension-seed.c
+++ b/tests/libpeas/extension-seed.c
@@ -25,8 +25,6 @@
 
 #include "testing/testing-extension.h"
 
-/*#define EXTENSION_TESTS("seed")*/
-
 int
 main (int   argc,
       char *argv[])
@@ -35,33 +33,33 @@ main (int   argc,
 
   g_type_init ();
 
-  _EXTENSION_TESTS_INIT ("seed");
+  _EXTENSION_TESTS_INIT (seed);
 
-  _EXTENSION_TEST ("seed", "garbage-collect", garbage_collect);
+  _EXTENSION_TEST (seed, "garbage-collect", garbage_collect);
 
-  _EXTENSION_TEST ("seed", "provides-valid", provides_valid);
-  _EXTENSION_TEST ("seed", "provides-invalid", provides_invalid);
+  _EXTENSION_TEST (seed, "provides-valid", provides_valid);
+  _EXTENSION_TEST (seed, "provides-invalid", provides_invalid);
 
-  _EXTENSION_TEST ("seed", "create-valid", create_valid);
-  _EXTENSION_TEST ("seed", "create-invalid", create_invalid);
+  _EXTENSION_TEST (seed, "create-valid", create_valid);
+  _EXTENSION_TEST (seed, "create-invalid", create_invalid);
 
-  _EXTENSION_TEST ("seed", "reload", reload);
+  _EXTENSION_TEST (seed, "reload", reload);
 
-  _EXTENSION_TEST ("seed", "call-invalid", call_invalid);
-  _EXTENSION_TEST ("seed", "call-no-args", call_no_args);
-  _EXTENSION_TEST ("seed", "call-with-return", call_with_return);
+  _EXTENSION_TEST (seed, "call-invalid", call_invalid);
+  _EXTENSION_TEST (seed, "call-no-args", call_no_args);
+  _EXTENSION_TEST (seed, "call-with-return", call_with_return);
 #ifdef SEED_EXTENSION_CALL_WITH_ARG_DONT_WORK
-  _EXTENSION_TEST ("seed", "call-single-arg", call_single_arg);
-  _EXTENSION_TEST ("seed", "call-multi-args", call_multi_args);
+  _EXTENSION_TEST (seed, "call-single-arg", call_single_arg);
+  _EXTENSION_TEST (seed, "call-multi-args", call_multi_args);
 #endif
 
 #ifdef SEED_EXTENSION_PROPERTIES_DONT_WORK
   /* Some tests don't fail when they should */
 
-  _EXTENSION_TEST ("seed", "properties-construct-only", properties_construct_only);
-  _EXTENSION_TEST ("seed", "properties-read-only", properties_read_only);
-  _EXTENSION_TEST ("seed", "properties-write-only", properties_write_only);
-  _EXTENSION_TEST ("seed", "properties-readwrite", properties_readwrite);
+  _EXTENSION_TEST (seed, "properties-construct-only", properties_construct_only);
+  _EXTENSION_TEST (seed, "properties-read-only", properties_read_only);
+  _EXTENSION_TEST (seed, "properties-write-only", properties_write_only);
+  _EXTENSION_TEST (seed, "properties-readwrite", properties_readwrite);
 #endif
 
   return testing_run_tests ();
diff --git a/tests/libpeas/testing/testing-extension.h b/tests/libpeas/testing/testing-extension.h
index c84ed7e..8e2b3fc 100644
--- a/tests/libpeas/testing/testing-extension.h
+++ b/tests/libpeas/testing/testing-extension.h
@@ -61,16 +61,16 @@ void testing_extension_properties_readwrite_      (PeasEngine *engine);
 
 #define _EXTENSION_TESTS_INIT(loader) \
   testing_init (); \
-  peas_engine_enable_loader (peas_engine_get_default (), loader); \
+  peas_engine_enable_loader (peas_engine_get_default (), #loader); \
   g_object_unref (peas_engine_get_default ()); \
-  testing_extension_set_plugin_ ("extension-" loader);
+  testing_extension_set_plugin_ ("extension-" #loader)
 
 #define _EXTENSION_TEST(loader, path, ftest) \
-  g_test_add ("/extension/" loader "/" path, TestingExtensionFixture_, \
+  g_test_add ("/extension/" #loader "/" path, TestingExtensionFixture_, \
               (gpointer) testing_extension_##ftest##_, \
               testing_extension_test_setup_, \
               testing_extension_test_runner_, \
-              testing_extension_test_teardown_);
+              testing_extension_test_teardown_)
 
 #define EXTENSION_TESTS(loader) \
   _EXTENSION_TESTS_INIT(loader); \
@@ -97,12 +97,12 @@ void testing_extension_properties_readwrite_      (PeasEngine *engine);
   _EXTENSION_TEST (loader, "properties-readwrite", properties_readwrite);
 
 /* This macro is there to add loader-specific tests. */
-#define EXTENSION_TEST_ADD(loader, path, func) \
-  g_test_add ("/extension/" loader "/" path, TestingExtensionFixture_, \
-              (gpointer) func, \
+#define EXTENSION_TEST(loader, path, func) \
+  g_test_add ("/extension/" #loader "/" path, TestingExtensionFixture_, \
+              (gpointer) test_extension_##loader##_##func, \
               testing_extension_test_setup_, \
               testing_extension_test_runner_, \
-              testing_extension_test_teardown_);
+              testing_extension_test_teardown_)
 
 G_END_DECLS
 



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