gplugin/gplugin

Parents 5b02e2cd29e2
Children 3075aaa51b17
make sure g_assert_no_error is checked before return values.

Testing Done:
Compiled and ran the unit tests locally.

Reviewed at https://reviews.imfreedom.org/r/327/
--- a/gplugin/gplugin-loader-tests.c Tue Dec 29 01:39:06 2020 -0600
+++ b/gplugin/gplugin-loader-tests.c Sun Jan 03 00:51:25 2021 -0600
@@ -173,8 +173,8 @@
g_assert_nonnull(plugin);
ret = gplugin_manager_load_plugin(plugin, &error);
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
g_assert_cmpint(
gplugin_plugin_get_state(plugin),
==,
--- a/gplugin/tests/test-dynamic-type.c Tue Dec 29 01:39:06 2020 -0600
+++ b/gplugin/tests/test-dynamic-type.c Sun Jan 03 00:51:25 2021 -0600
@@ -32,6 +32,7 @@
GPluginPlugin *provider = NULL, *user = NULL;
GPluginPluginState state;
GError *error = NULL;
+ gboolean ret = FALSE;
gplugin_manager_append_path(TEST_DYNAMIC_DIR);
gplugin_manager_refresh();
@@ -39,8 +40,9 @@
provider = gplugin_manager_find_plugin("gplugin/dynamic-type-provider");
g_assert_nonnull(provider);
- g_assert_true(gplugin_manager_load_plugin(provider, &error));
+ ret = gplugin_manager_load_plugin(provider, &error);
g_assert_no_error(error);
+ g_assert_true(ret);
state = gplugin_plugin_get_state(provider);
g_assert_cmpint(state, ==, GPLUGIN_PLUGIN_STATE_LOADED);
@@ -48,21 +50,24 @@
user = gplugin_manager_find_plugin("gplugin/dynamic-type-user");
g_assert_nonnull(user);
- g_assert_true(gplugin_manager_load_plugin(user, &error));
+ ret = gplugin_manager_load_plugin(user, &error);
g_assert_no_error(error);
+ g_assert_true(ret);
state = gplugin_plugin_get_state(user);
g_assert_cmpint(state, ==, GPLUGIN_PLUGIN_STATE_LOADED);
/* now unload the plugin */
- g_assert_true(gplugin_manager_unload_plugin(user, &error));
+ ret = gplugin_manager_unload_plugin(user, &error);
g_assert_no_error(error);
+ g_assert_true(ret);
state = gplugin_plugin_get_state(user);
g_assert_cmpint(state, ==, GPLUGIN_PLUGIN_STATE_QUERIED);
- g_assert_true(gplugin_manager_unload_plugin(provider, &error));
+ ret = gplugin_manager_unload_plugin(provider, &error);
g_assert_no_error(error);
+ g_assert_true(ret);
state = gplugin_plugin_get_state(provider);
g_assert_cmpint(state, ==, GPLUGIN_PLUGIN_STATE_QUERIED);
--- a/gplugin/tests/test-loader-registration.c Tue Dec 29 01:39:06 2020 -0600
+++ b/gplugin/tests/test-loader-registration.c Sun Jan 03 00:51:25 2021 -0600
@@ -101,14 +101,12 @@
gplugin_manager_private_init(TRUE);
ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
-
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
-
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
}
static void
@@ -121,8 +119,8 @@
gplugin_manager_private_init(TRUE);
ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
g_assert_false(ret);
@@ -130,9 +128,8 @@
g_clear_error(&error);
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
-
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
}
static void
@@ -145,12 +142,12 @@
gplugin_manager_private_init(TRUE);
ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
g_assert_false(ret);
--- a/gplugin/tests/test-versioned-dependencies.c Tue Dec 29 01:39:06 2020 -0600
+++ b/gplugin/tests/test-versioned-dependencies.c Sun Jan 03 00:51:25 2021 -0600
@@ -56,9 +56,8 @@
g_assert_true(GPLUGIN_IS_PLUGIN(plugin));
ret = gplugin_manager_load_plugin(plugin, &error);
-
+ g_assert_no_error(error);
g_assert_true(ret);
- g_assert_no_error(error);
g_assert_cmpint(
gplugin_plugin_get_state(plugin),