[libpeas] Added Seed version of PeasExtension tests



commit f896a1ec724339a762caab31f816d210976cce88
Author: Garrett Regier <alias301 gmail com>
Date:   Mon Jan 17 16:42:36 2011 -0800

    Added Seed version of PeasExtension tests
    
    For now the calling with args and property tests are disabled.

 .gitignore                                         |    1 +
 configure.ac                                       |    1 +
 tests/libpeas/Makefile.am                          |   40 +++++++------
 tests/libpeas/extension-seed.c                     |   63 ++++++++++++++++++++
 tests/libpeas/plugins/Makefile.am                  |    4 +
 tests/libpeas/plugins/extension-seed/Makefile.am   |    5 ++
 .../plugins/extension-seed/extension-seed.js       |   20 ++++++
 .../plugins/extension-seed/extension-seed.plugin   |    9 +++
 8 files changed, 124 insertions(+), 19 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 81330a8..ae4fc73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@ Makefile.in
 /tests/libpeas/engine
 /tests/libpeas/extension-c
 /tests/libpeas/extension-python
+/tests/libpeas/extension-seed
 /tests/libpeas/extension-set
 /tests/libpeas/plugin-info
 /tests/libpeas-gtk/plugin-manager
diff --git a/configure.ac b/configure.ac
index 3840b77..d3941b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -316,6 +316,7 @@ tests/libpeas/Makefile
 tests/libpeas/plugins/Makefile
 tests/libpeas/plugins/extension-c/Makefile
 tests/libpeas/plugins/extension-python/Makefile
+tests/libpeas/plugins/extension-seed/Makefile
 tests/libpeas/introspection/Makefile
 tests/libpeas/testing/Makefile
 tests/libpeas-gtk/Makefile
diff --git a/tests/libpeas/Makefile.am b/tests/libpeas/Makefile.am
index e33f2a7..9759355 100644
--- a/tests/libpeas/Makefile.am
+++ b/tests/libpeas/Makefile.am
@@ -17,29 +17,31 @@ progs_ldadd = \
 	./testing/libtesting.la			\
 	./introspection/libintrospection-1.0.la
 
-TEST_PROGS += \
-	engine		\
-	extension-c	\
-	extension-set	\
-	plugin-info
 
-if ENABLE_PYTHON
-TEST_PROGS += extension-python
-endif
-
-engine_SOURCES = engine.c
-engine_LDADD   = $(progs_ldadd)
+TEST_PROGS     += engine
+engine_SOURCES  = engine.c
+engine_LDADD    = $(progs_ldadd)
 
-extension_c_SOURCES = extension-c.c
-extension_c_LDADD   = $(progs_ldadd)
+TEST_PROGS          += extension-c
+extension_c_SOURCES  = extension-c.c
+extension_c_LDADD    = $(progs_ldadd)
 
 if ENABLE_PYTHON
-extension_python_SOURCES = extension-python.c
-extension_python_LDADD   = $(progs_ldadd)
+TEST_PROGS               += extension-python
+extension_python_SOURCES  = extension-python.c
+extension_python_LDADD    = $(progs_ldadd)
+endif
+
+if ENABLE_SEED
+TEST_PROGS             += extension-seed
+extension_seed_SOURCES  = extension-seed.c
+extension_seed_LDADD    = $(progs_ldadd)
 endif
 
-extension_set_SOURCES = extension-set.c
-extension_set_LDADD   = $(progs_ldadd)
+TEST_PROGS            += extension-set
+extension_set_SOURCES  = extension-set.c
+extension_set_LDADD    = $(progs_ldadd)
 
-plugin_info_SOURCES = plugin-info.c
-plugin_info_LDADD   = $(progs_ldadd)
+TEST_PROGS          += plugin-info
+plugin_info_SOURCES  = plugin-info.c
+plugin_info_LDADD    = $(progs_ldadd)
diff --git a/tests/libpeas/extension-seed.c b/tests/libpeas/extension-seed.c
new file mode 100644
index 0000000..96efadc
--- /dev/null
+++ b/tests/libpeas/extension-seed.c
@@ -0,0 +1,63 @@
+/*
+ * extension-seed.c
+ * This file is part of libpeas
+ *
+ * Copyright (C) 2011 - Garrett Regier
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Library General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "testing/testing-extension.h"
+
+/*#define EXTENSION_TESTS("seed")*/
+
+int
+main (int   argc,
+      char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_type_init ();
+
+  testing_extension_set_plugin_ ("extension-" "seed");
+
+  _EXTENSION_TEST ("seed", "create-valid", create_valid);
+  _EXTENSION_TEST ("seed", "create-invalid", create_invalid);
+
+  _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);
+#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);
+#endif
+
+  g_object_unref (peas_engine_get_default ());
+
+  return g_test_run ();
+}
diff --git a/tests/libpeas/plugins/Makefile.am b/tests/libpeas/plugins/Makefile.am
index 43efb2d..fff17ad 100644
--- a/tests/libpeas/plugins/Makefile.am
+++ b/tests/libpeas/plugins/Makefile.am
@@ -4,6 +4,10 @@ if ENABLE_PYTHON
 SUBDIRS += extension-python
 endif
 
+if ENABLE_SEED
+SUBDIRS += extension-seed
+endif
+
 noinst_DATA = \
 	info-missing-iage.plugin	\
 	info-missing-module.plugin	\
diff --git a/tests/libpeas/plugins/extension-seed/Makefile.am b/tests/libpeas/plugins/extension-seed/Makefile.am
new file mode 100644
index 0000000..cf3849e
--- /dev/null
+++ b/tests/libpeas/plugins/extension-seed/Makefile.am
@@ -0,0 +1,5 @@
+noinst_DATA = \
+	extension-seed.js	\
+	extension-seed.plugin
+
+EXTRA_DIST = $(noinst_DATA)
diff --git a/tests/libpeas/plugins/extension-seed/extension-seed.js b/tests/libpeas/plugins/extension-seed/extension-seed.js
new file mode 100644
index 0000000..a50ba75
--- /dev/null
+++ b/tests/libpeas/plugins/extension-seed/extension-seed.js
@@ -0,0 +1,20 @@
+callable_extension = {
+  call_with_return: function() {
+    return "Hello, World!"
+  },
+  call_no_args: function() {
+  },
+  call_single_arg: function() {
+    return true
+  },
+  call_mulit_args: function() {
+    return [ true, true, true ]
+  }
+};
+
+properties_extension = {};
+
+extensions = {
+  "IntrospectionCallable": callable_extension,
+  "IntrospectionProperties" : properties_extension
+};
diff --git a/tests/libpeas/plugins/extension-seed/extension-seed.plugin b/tests/libpeas/plugins/extension-seed/extension-seed.plugin
new file mode 100644
index 0000000..e60c402
--- /dev/null
+++ b/tests/libpeas/plugins/extension-seed/extension-seed.plugin
@@ -0,0 +1,9 @@
+[Plugin]
+Module=extension-seed
+Loader=seed
+IAge=2
+Name=Extension Seed
+Description=This plugin is for the Seed PeasExtension tests.
+Authors=Garrett Regier
+Copyright=Copyright © 2011 Garrett Regier
+Website=http://live.gnome.org/Libpeas



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