From: Andrea Zagli Date: Wed, 28 Sep 2016 15:27:33 +0000 (+0200) Subject: Added test from ZakConfi::get_configs_list. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=949071552d71a051f44e3b4ef279b46978d4f907;p=zakconfi%2Flibzakconfi Added test from ZakConfi::get_configs_list. --- diff --git a/.gitignore b/.gitignore index 4156f9f..bd44a40 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ intltool-* Rules-quot *.exe tests/test +tests/test_get_configs_list *.csv gtk-doc.m4 *.gir diff --git a/tests/Makefile.am b/tests/Makefile.am index ab6b30a..0f2cbdc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -9,6 +9,7 @@ LIBS = $(LIBCONFI_LIBS) \ LDADD = $(top_builddir)/src/libzakconfi.la -noinst_PROGRAMS = test +noinst_PROGRAMS = test \ + test_get_configs_list EXTRA_DIST = gir.py diff --git a/tests/test.c b/tests/test.c index 3c0b58b..9130fb8 100644 --- a/tests/test.c +++ b/tests/test.c @@ -37,7 +37,6 @@ main (int argc, char **argv) PeasEngine *engine; ZakConfi *confi; PeasPluginInfo *ppinfo; - GList *confis; GNode *tree; if (argc < 2) @@ -49,19 +48,6 @@ main (int argc, char **argv) engine = peas_engine_get_default (); peas_engine_add_search_path (engine, "./plugins", NULL); - confis = zak_confi_get_configs_list (argv[1], NULL); - while (confis) - { - ZakConfiConfi *confi = (ZakConfiConfi *)confis->data; - - if (confi == NULL) break; - - g_printf ("NAME: %s\nDESCRIPTION: %s\n\n", - confi->name, - confi->description); - confis = g_list_next (confis); - } - confi = zak_confi_new (argv[1]); if (confi == NULL) { diff --git a/tests/test_get_configs_list.c b/tests/test_get_configs_list.c new file mode 100644 index 0000000..89b38bc --- /dev/null +++ b/tests/test_get_configs_list.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2016 Andrea Zagli + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU 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. + */ + +#include +#include + +#include "libzakconfi.h" + +int +main (int argc, char **argv) +{ + PeasEngine *engine; + PeasPluginInfo *ppinfo; + GList *confis; + + if (argc < 2) + { + g_error ("Usage: test_get_configs_list "); + return 0; + } + + engine = peas_engine_get_default (); + peas_engine_add_search_path (engine, "./plugins", NULL); + + confis = zak_confi_get_configs_list (argv[1], NULL); + while (confis) + { + ZakConfiConfi *confi = (ZakConfiConfi *)confis->data; + + if (confi == NULL) break; + + g_printf ("NAME: %s\nDESCRIPTION: %s\n\n", + confi->name, + confi->description); + confis = g_list_next (confis); + } + + return 0; +}