gplugin/gplugin

6b762ae14f4c
Parents 47dde5d58de9
Children feeaba4c7a19
Fix some leaks in the loader-registration test and make it easier to include gplugin-private
--- a/gplugin/gplugin-private.h Mon Mar 09 21:22:16 2020 -0500
+++ b/gplugin/gplugin-private.h Mon Mar 09 21:27:20 2020 -0500
@@ -14,19 +14,19 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-
-#if !defined(GPLUGIN_GLOBAL_HEADER_INSIDE) && !defined(GPLUGIN_COMPILATION)
-#error "only <gplugin.h> may be included directly"
-#endif
-
#ifndef GPLUGIN_PRIVATE_H
#define GPLUGIN_PRIVATE_H
#include <glib.h>
#include <glib-object.h>
+/* this gets included by some tests so we need to trick the headers to accept
+ * it.
+ */
+#define GPLUGIN_GLOBAL_HEADER_INSIDE
#include <gplugin/gplugin-plugin-info.h>
#include <gplugin/gplugin-plugin.h>
+#undef GPLUGIN_GLOBAL_HEADER_INSIDE
G_BEGIN_DECLS
--- a/gplugin/tests/test-loader-registration.c Mon Mar 09 21:22:16 2020 -0500
+++ b/gplugin/tests/test-loader-registration.c Mon Mar 09 21:27:20 2020 -0500
@@ -17,10 +17,7 @@
#include <gplugin.h>
-/* it's getting dirty in here... */
-#define GPLUGIN_COMPILATION
#include "../gplugin-private.h"
-#undef GPLUGIN_COMPILATION
#include <glib.h>
@@ -125,6 +122,7 @@
ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
g_assert_false(ret);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_clear_error(&error);
}
static void
@@ -167,6 +165,7 @@
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
g_assert_false(ret);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_clear_error(&error);
}
/******************************************************************************
@@ -175,6 +174,7 @@
gint
main(gint argc, gchar **argv)
{
+ gint r = 0;
g_test_init(&argc, &argv, NULL);
@@ -194,5 +194,9 @@
"/manager/loader/unregister-twice",
test_gplugin_manager_loader_unregister_twice);
- return g_test_run();
+ r = g_test_run();
+
+ gplugin_uninit();
+
+ return r;
}