[libpeas] Assert that testing interfaces are implemented
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Assert that testing interfaces are implemented
- Date: Fri, 10 Feb 2012 20:32:03 +0000 (UTC)
commit a702253f26bb3a2059fea5e6ee318eb85712eaf0
Author: Garrett Regier <garrettregier gmail com>
Date: Thu Dec 8 18:55:43 2011 -0800
Assert that testing interfaces are implemented
.../libpeas/introspection/introspection-callable.c | 20 +++++++++++---------
.../libpeas/plugins/extension-c/callable-plugin.c | 6 ++++++
2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/tests/libpeas/introspection/introspection-callable.c b/tests/libpeas/introspection/introspection-callable.c
index a411480..793bf32 100644
--- a/tests/libpeas/introspection/introspection-callable.c
+++ b/tests/libpeas/introspection/introspection-callable.c
@@ -46,10 +46,9 @@ introspection_callable_call_with_return (IntrospectionCallable *callable)
g_return_val_if_fail (INTROSPECTION_IS_CALLABLE (callable), NULL);
iface = INTROSPECTION_CALLABLE_GET_IFACE (callable);
- if (iface->call_with_return != NULL)
- return iface->call_with_return (callable);
+ g_assert (iface->call_with_return != NULL);
- return NULL;
+ return iface->call_with_return (callable);
}
/**
@@ -64,8 +63,9 @@ introspection_callable_call_no_args (IntrospectionCallable *callable)
g_return_if_fail (INTROSPECTION_IS_CALLABLE (callable));
iface = INTROSPECTION_CALLABLE_GET_IFACE (callable);
- if (iface->call_no_args != NULL)
- iface->call_no_args (callable);
+ g_assert (iface->call_no_args != NULL);
+
+ iface->call_no_args (callable);
}
/**
@@ -82,8 +82,9 @@ introspection_callable_call_single_arg (IntrospectionCallable *callable,
g_return_if_fail (INTROSPECTION_IS_CALLABLE (callable));
iface = INTROSPECTION_CALLABLE_GET_IFACE (callable);
- if (iface->call_single_arg != NULL)
- iface->call_single_arg (callable, called);
+ g_assert (iface->call_single_arg != NULL);
+
+ iface->call_single_arg (callable, called);
}
/**
@@ -104,6 +105,7 @@ introspection_callable_call_multi_args (IntrospectionCallable *callable,
g_return_if_fail (INTROSPECTION_IS_CALLABLE (callable));
iface = INTROSPECTION_CALLABLE_GET_IFACE (callable);
- if (iface->call_multi_args != NULL)
- iface->call_multi_args (callable, in, out, inout);
+ g_assert (iface->call_multi_args != NULL);
+
+ iface->call_multi_args (callable, in, out, inout);
}
diff --git a/tests/libpeas/plugins/extension-c/callable-plugin.c b/tests/libpeas/plugins/extension-c/callable-plugin.c
index b8b1366..c0310fd 100644
--- a/tests/libpeas/plugins/extension-c/callable-plugin.c
+++ b/tests/libpeas/plugins/extension-c/callable-plugin.c
@@ -71,6 +71,11 @@ testing_callable_plugin_get_settings (IntrospectionBase *base)
return peas_plugin_info_get_settings (info, NULL);
}
+static void
+testing_callable_plugin_call_no_args (IntrospectionCallable *callable)
+{
+}
+
static const gchar *
testing_callable_plugin_call_with_return (IntrospectionCallable *callable)
{
@@ -109,6 +114,7 @@ introspection_base_iface_init (IntrospectionBaseInterface *iface)
static void
introspection_callable_iface_init (IntrospectionCallableInterface *iface)
{
+ iface->call_no_args = testing_callable_plugin_call_no_args;
iface->call_with_return = testing_callable_plugin_call_with_return;
iface->call_single_arg = testing_callable_plugin_call_single_arg;
iface->call_multi_args = testing_callable_plugin_call_multi_args;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]