[libpeas: 12/18] Add an extension test for garbage collection



commit 44af1b09d3b706e2d08ff2e91cc62bb2e0615bd0
Author: Garrett Regier <alias301 gmail com>
Date:   Thu Mar 3 04:36:48 2011 -0800

    Add an extension test for garbage collection

 tests/libpeas/extension-python.c          |    2 ++
 tests/libpeas/extension-seed.c            |    2 ++
 tests/libpeas/testing/testing-extension.c |   15 +++++++++++++++
 tests/libpeas/testing/testing-extension.h |    3 +++
 4 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/libpeas/extension-python.c b/tests/libpeas/extension-python.c
index 2d7fa25..ddd0304 100644
--- a/tests/libpeas/extension-python.c
+++ b/tests/libpeas/extension-python.c
@@ -42,6 +42,8 @@ main (int   argc,
 
   testing_extension_set_plugin_ ("extension-" "python");
 
+  _EXTENSION_TEST ("python", "garbage-collect", garbage_collect);
+
   _EXTENSION_TEST ("python", "create-valid", create_valid);
   _EXTENSION_TEST ("python", "create-invalid", create_invalid);
 
diff --git a/tests/libpeas/extension-seed.c b/tests/libpeas/extension-seed.c
index a5b0961..f2561a8 100644
--- a/tests/libpeas/extension-seed.c
+++ b/tests/libpeas/extension-seed.c
@@ -42,6 +42,8 @@ main (int   argc,
 
   testing_extension_set_plugin_ ("extension-" "seed");
 
+  _EXTENSION_TEST ("seed", "garbage-collect", garbage_collect);
+
   _EXTENSION_TEST ("seed", "create-valid", create_valid);
   _EXTENSION_TEST ("seed", "create-invalid", create_invalid);
 
diff --git a/tests/libpeas/testing/testing-extension.c b/tests/libpeas/testing/testing-extension.c
index fb5be32..09cc76e 100644
--- a/tests/libpeas/testing/testing-extension.c
+++ b/tests/libpeas/testing/testing-extension.c
@@ -67,6 +67,21 @@ testing_extension_test_runner_  (TestingExtensionFixture_ *fixture,
 }
 
 void
+testing_extension_garbage_collect_ (PeasEngine *engine)
+{
+  PeasPluginInfo *info;
+
+  info = peas_engine_get_plugin_info (engine, extension_plugin);
+
+  /* See that we can collect the garbage when no plugins are loaded */
+  peas_engine_garbage_collect (engine);
+
+  g_assert (peas_engine_load_plugin (engine, info));
+
+  peas_engine_garbage_collect (engine);
+}
+
+void
 testing_extension_create_valid_ (PeasEngine *engine)
 {
   PeasPluginInfo *info;
diff --git a/tests/libpeas/testing/testing-extension.h b/tests/libpeas/testing/testing-extension.h
index 38e2808..53945db 100644
--- a/tests/libpeas/testing/testing-extension.h
+++ b/tests/libpeas/testing/testing-extension.h
@@ -43,6 +43,7 @@ void testing_extension_test_teardown_ (TestingExtensionFixture_ *fixture,
 void testing_extension_test_runner_   (TestingExtensionFixture_ *fixture,
                                        gconstpointer             data);
 
+void testing_extension_garbage_collect_           (PeasEngine *engine);
 void testing_extension_create_valid_              (PeasEngine *engine);
 void testing_extension_create_invalid_            (PeasEngine *engine);
 void testing_extension_reload_                    (PeasEngine *engine);
@@ -80,6 +81,8 @@ main (int   argc, \
 \
   testing_extension_set_plugin_ ("extension-" loader); \
 \
+  _EXTENSION_TEST (loader, "garbage-collect", garbage_collect); \
+\
   _EXTENSION_TEST (loader, "create-valid", create_valid); \
   _EXTENSION_TEST (loader, "create-invalid", create_invalid); \
 \



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