[libpeas] Add a test for missing peas_register_types() in a C plugin
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Add a test for missing peas_register_types() in a C plugin
- Date: Sat, 20 Dec 2014 17:21:30 +0000 (UTC)
commit f275d63243a2623cf5ef4ea39da1a613e0cb179b
Author: Garrett Regier <garrettregier gmail com>
Date: Sat Aug 23 09:01:22 2014 -0700
Add a test for missing peas_register_types() in a C plugin
tests/libpeas/extension-c.c | 16 +++++++++++
tests/libpeas/plugins/extension-c/Makefile.am | 15 +++++++++--
.../extension-c-missing-symbol-plugin.c | 27 ++++++++++++++++++++
.../extension-c/extension-c-missing-symbol.plugin | 7 +++++
4 files changed, 62 insertions(+), 3 deletions(-)
---
diff --git a/tests/libpeas/extension-c.c b/tests/libpeas/extension-c.c
index c450ec8..329f562 100644
--- a/tests/libpeas/extension-c.c
+++ b/tests/libpeas/extension-c.c
@@ -99,6 +99,21 @@ test_extension_c_local_linkage (PeasEngine *engine,
g_object_unref (c_extension);
}
+static void
+test_extension_c_missing_symbol (PeasEngine *engine)
+{
+ PeasPluginInfo *info;
+
+ testing_util_push_log_hook ("Failed to get 'peas_register_types' for "
+ "module 'extension-c-missing-symbol'*");
+ testing_util_push_log_hook ("Error loading plugin "
+ "'extension-c-missing-symbol'");
+
+ info = peas_engine_get_plugin_info (engine, "extension-c-missing-symbol");
+
+ g_assert (!peas_engine_load_plugin (engine, info));
+}
+
int
main (int argc,
char *argv[])
@@ -116,6 +131,7 @@ main (int argc,
EXTENSION_TEST (c, "instance-refcount", instance_refcount);
EXTENSION_TEST (c, "nonexistent", nonexistent);
EXTENSION_TEST (c, "local-linkage", local_linkage);
+ EXTENSION_TEST (c, "missing-symbol", missing_symbol);
return testing_extension_run_tests ();
}
diff --git a/tests/libpeas/plugins/extension-c/Makefile.am b/tests/libpeas/plugins/extension-c/Makefile.am
index fadebe1..9f18008 100644
--- a/tests/libpeas/plugins/extension-c/Makefile.am
+++ b/tests/libpeas/plugins/extension-c/Makefile.am
@@ -7,7 +7,9 @@ AM_CPPFLAGS = \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED)
-noinst_LTLIBRARIES = libextension-c.la
+noinst_LTLIBRARIES = \
+ libextension-c.la \
+ libextension-c-missing-symbol.la
libextension_c_la_SOURCES = \
extension-c-plugin.c \
@@ -18,8 +20,15 @@ libextension_c_la_LIBADD = \
$(PEAS_LIBS) \
$(builddir)/../../introspection/libintrospection-1.0.la
+libextension_c_missing_symbol_la_SOURCES = \
+ extension-c-missing-symbol-plugin.c
+
+libextension_c_missing_symbol_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
+libextension_c_missing_symbol_la_LIBADD = $(PEAS_LIBS)
+
noinst_PLUGIN = \
- extension-c.gschema.xml \
- extension-c.plugin
+ extension-c.gschema.xml \
+ extension-c.plugin \
+ extension-c-missing-symbol.plugin
EXTRA_DIST = $(noinst_PLUGIN)
diff --git a/tests/libpeas/plugins/extension-c/extension-c-missing-symbol-plugin.c
b/tests/libpeas/plugins/extension-c/extension-c-missing-symbol-plugin.c
new file mode 100644
index 0000000..7dfc275
--- /dev/null
+++ b/tests/libpeas/plugins/extension-c/extension-c-missing-symbol-plugin.c
@@ -0,0 +1,27 @@
+/*
+ * extension-c-missing-symbol-plugin.c
+ * This file is part of libpeas
+ *
+ * Copyright (C) 2014 - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#if 0
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+}
+#endif
diff --git a/tests/libpeas/plugins/extension-c/extension-c-missing-symbol.plugin
b/tests/libpeas/plugins/extension-c/extension-c-missing-symbol.plugin
new file mode 100644
index 0000000..f3ce1f7
--- /dev/null
+++ b/tests/libpeas/plugins/extension-c/extension-c-missing-symbol.plugin
@@ -0,0 +1,7 @@
+[Plugin]
+Module=extension-c-missing-symbol
+Name=Extension C Missing Symbol
+Description=This plugin is missing peas_register_types.
+Authors=Garrett Regier
+Copyright=Copyright © 2014 Garrett Regier
+Website=http://live.gnome.org/Libpeas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]