[gnome-builder] tests: load c plugin for c indenter used in test
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] tests: load c plugin for c indenter used in test
- Date: Thu, 16 Jul 2015 21:10:43 +0000 (UTC)
commit f6ae5b80553ee88cce37b3409f4f6a93f50df95a
Author: Christian Hergert <christian hergert me>
Date: Wed Jul 15 22:12:01 2015 -0700
tests: load c plugin for c indenter used in test
tests/test-ide-indenter.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-ide-indenter.c b/tests/test-ide-indenter.c
index 1464fbb..0ac1fc1 100644
--- a/tests/test-ide-indenter.c
+++ b/tests/test-ide-indenter.c
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <libpeas/peas.h>
#include <girepository.h>
#include <ide.h>
#include <string.h>
@@ -30,6 +31,46 @@ typedef struct
} IndentTest;
static void
+load_plugins (void)
+{
+ PeasEngine *engine;
+ const GList *list;
+ GDir *dir;
+
+ engine = peas_engine_get_default ();
+
+ if ((dir = g_dir_open ("../plugins", 0, NULL)))
+ {
+ const gchar *name;
+
+ while ((name = g_dir_read_name (dir)))
+ {
+ gchar *path;
+
+ path = g_build_filename ("..", "plugins", name, NULL);
+ peas_engine_prepend_search_path (engine, path, path);
+ g_free (path);
+ }
+
+ g_dir_close (dir);
+ }
+
+ peas_engine_rescan_plugins (engine);
+ list = peas_engine_get_plugin_list (engine);
+
+ for (; list; list = list->next)
+ {
+ PeasPluginInfo *info = list->data;
+
+ if (g_strcmp0 (peas_plugin_info_get_module_name (info), "c-pack-plugin") == 0)
+ {
+ if (!peas_plugin_info_is_loaded (info))
+ peas_engine_load_plugin (engine, info);
+ }
+ }
+}
+
+static void
new_context_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
@@ -246,6 +287,8 @@ test_cindenter_basic_cb (IdeContext *context,
static void
test_cindenter_basic (void)
{
+ load_plugins ();
+
run_test ("test.c", test_cindenter_basic_cb);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]