[gobject-introspection] Add a bunch of new tests for nullable args in Everything module
- From: Zach Goldberg <zgoldberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Add a bunch of new tests for nullable args in Everything module
- Date: Sat, 17 Apr 2010 21:27:53 +0000 (UTC)
commit 7b6656e2f39d88671758dbf0775688fc53660936
Author: Zach Goldberg <zach zachgoldberg com>
Date: Sat Apr 17 13:37:54 2010 -0400
Add a bunch of new tests for nullable args in Everything module
https://bugzilla.gnome.org/show_bug.cgi?id=616039
gir/Everything-1.0-expected.gir | 115 +++++++++++++++++++++++++++++++++++++++
gir/everything.c | 85 +++++++++++++++++++++++++++++
gir/everything.h | 9 +++
3 files changed, 209 insertions(+), 0 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 6503f05..bd7eba1 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -726,6 +726,44 @@ case.">
</parameter>
</parameters>
</function>
+ <function name="test_array_int_null_in"
+ c:identifier="test_array_int_null_in">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr" transfer-ownership="none" allow-none="1">
+ <array c:type="int*">
+ <type name="int"/>
+ </array>
+ </parameter>
+ <parameter name="len" transfer-ownership="none">
+ <type name="int" c:type="int"/>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_array_int_null_out"
+ c:identifier="test_array_int_null_out">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr"
+ direction="out"
+ transfer-ownership="full"
+ allow-none="1">
+ <array c:type="int**">
+ <type name="int"/>
+ </array>
+ </parameter>
+ <parameter name="len"
+ direction="out"
+ transfer-ownership="full"
+ doc=": length">
+ <type name="int" c:type="int*"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_array_int_out" c:identifier="test_array_int_out">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -1136,6 +1174,16 @@ call and can be released on return.">
</parameter>
</parameters>
</function>
+ <function name="test_ghash_null_out" c:identifier="test_ghash_null_out">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="out" transfer-ownership="none">
+ <type name="GLib.HashTable" c:type="GHashTable**"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_ghash_null_return"
c:identifier="test_ghash_null_return">
<return-value transfer-ownership="none">
@@ -1241,6 +1289,28 @@ call and can be released on return.">
</type>
</return-value>
</function>
+ <function name="test_glist_null_in" c:identifier="test_glist_null_in">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="in" transfer-ownership="none" allow-none="1">
+ <type name="GLib.SList" c:type="GSList*">
+ <type name="utf8"/>
+ </type>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_glist_null_out" c:identifier="test_glist_null_out">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="list_out" transfer-ownership="none">
+ <type name="GLib.SList" c:type="GSList**"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_gslist_container_in"
c:identifier="test_gslist_container_in">
<return-value transfer-ownership="none">
@@ -1337,6 +1407,28 @@ call and can be released on return.">
</type>
</return-value>
</function>
+ <function name="test_gslist_null_in" c:identifier="test_gslist_null_in">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="in" transfer-ownership="none" allow-none="1">
+ <type name="GLib.SList" c:type="GSList*">
+ <type name="utf8"/>
+ </type>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_gslist_null_out" c:identifier="test_gslist_null_out">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="out_list" transfer-ownership="none">
+ <type name="GLib.SList" c:type="GSList**"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_gtype" c:identifier="test_gtype">
<return-value transfer-ownership="none">
<type name="GType" c:type="GType"/>
@@ -1775,6 +1867,29 @@ call and can be released on return.">
<type name="utf8" c:type="char*"/>
</return-value>
</function>
+ <function name="test_utf8_null_in" c:identifier="test_utf8_null_in">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="in" transfer-ownership="full" allow-none="1">
+ <type name="utf8" c:type="char*"/>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_utf8_null_out" c:identifier="test_utf8_null_out">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="char_out"
+ direction="out"
+ transfer-ownership="full"
+ allow-none="1">
+ <type name="utf8" c:type="char**"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_utf8_out" c:identifier="test_utf8_out">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
diff --git a/gir/everything.c b/gir/everything.c
index 006798a..5e4aaaa 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -416,6 +416,24 @@ test_utf8_out_nonconst_return (char **out)
return g_strdup ("first");
}
+/**
+ * test_utf8_null_in:
+ * @in: (allow-none):
+ */
+void test_utf8_null_in (char *in)
+{
+ g_assert (in == NULL);
+}
+
+/**
+ * test_utf8_null_out:
+ * @char_out: (allow-none) (out):
+ */
+void test_utf8_null_out (char **char_out)
+{
+ *char_out = NULL;
+}
+
/* non-basic-types */
@@ -733,6 +751,27 @@ test_array_int_none_out(int *len) {
return result;
}
+/**
+ * test_array_int_null_in:
+ * @arr: (array length=1) (allow-none):
+ * @len: length
+ */
+void test_array_int_null_in (int *arr, int len)
+{
+ g_assert (arr == NULL);
+}
+
+/**
+ * test_array_int_null_out:
+ * @arr: (out) (array length=1) (allow-none):
+ * @len: (out) : length
+ */
+void test_array_int_null_out (int **arr, int *len)
+{
+ *arr = NULL;
+ *len = 0;
+}
+
/* interface */
/************************************************************************/
@@ -857,6 +896,25 @@ void test_glist_everything_in (GList *in)
test_glist_free (in);
}
+/**
+ * test_glist_null_in:
+ * @in: (element-type utf8) (allow-none):
+ */
+void test_glist_null_in (GSList *in)
+{
+ g_assert (in == NULL);
+}
+
+/**
+ * test_glist_null_out:
+ * @out_list: (out) (element-type utf8) (allow-none):
+ */
+void test_glist_null_out (GSList **out_list)
+{
+ *out_list = NULL;
+}
+
+
/************************************************************************/
/* GSList */
@@ -979,6 +1037,24 @@ void test_gslist_everything_in (GSList *in)
test_gslist_free (in);
}
+/**
+ * test_gslist_null_in:
+ * @in: (element-type utf8) (allow-none):
+ */
+void test_gslist_null_in (GSList *in)
+{
+ g_assert (in == NULL);
+}
+
+/**
+ * test_gslist_null_out:
+ * @out_list: (out) (element-type utf8) (allow-none):
+ */
+void test_gslist_null_out (GSList **out_list)
+{
+ *out_list = NULL;
+}
+
/************************************************************************/
/* GHash */
@@ -1102,6 +1178,15 @@ void test_ghash_null_in (const GHashTable *in)
}
/**
+ * test_ghash_null_out:
+ * @out: (element-type utf8 utf8) (allow-none) (out):
+ */
+void test_ghash_null_out (const GHashTable **out)
+{
+ *out = NULL;
+}
+
+/**
* test_ghash_nothing_in:
* @in: (element-type utf8 utf8):
*/
diff --git a/gir/everything.h b/gir/everything.h
index 5521c4a..c20d88e 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -40,6 +40,8 @@ void test_utf8_const_in (const char *in);
void test_utf8_out (char **out);
void test_utf8_inout (char **inout);
GSList *test_filename_return (void);
+void test_utf8_null_in (char *in);
+void test_utf8_null_out (char **char_out);
/* in arguments after out arguments */
void test_int_out_utf8 (int *length, const char *in);
@@ -74,6 +76,8 @@ gboolean test_strv_in_container (char **arr);
int *test_array_int_full_out(int *len);
int *test_array_int_none_out(int *len);
+void test_array_int_null_in (int *arr, int len);
+void test_array_int_null_out (int **arr, int *len);
/* interface */
/* GList */
@@ -85,6 +89,8 @@ void test_glist_nothing_in (const GList *in);
void test_glist_nothing_in2 (GList *in);
void test_glist_container_in (GList *in);
void test_glist_everything_in (GList *in);
+void test_glist_null_in(GSList *in);
+void test_glist_null_out(GSList **out_list);
void test_glist_free (GList *in);
/* GSList */
@@ -96,6 +102,8 @@ void test_gslist_nothing_in (const GSList *in);
void test_gslist_nothing_in2 (GSList *in);
void test_gslist_container_in (GSList *in);
void test_gslist_everything_in (GSList *in);
+void test_gslist_null_in(GSList *in);
+void test_gslist_null_out(GSList **out_list);
void test_gslist_free (GSList *in);
/* GHashTable */
@@ -105,6 +113,7 @@ GHashTable *test_ghash_nothing_return2 (void);
GHashTable *test_ghash_container_return (void);
GHashTable *test_ghash_everything_return (void);
void test_ghash_null_in (const GHashTable *in);
+void test_ghash_null_out (const GHashTable **out);
void test_ghash_nothing_in (const GHashTable *in);
void test_ghash_nothing_in2 (GHashTable *in);
void test_ghash_container_in (GHashTable *in);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]