[vala] tests: Add gir-test for fixed-size arrays
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] tests: Add gir-test for fixed-size arrays
- Date: Sun, 27 Nov 2016 11:07:54 +0000 (UTC)
commit 60fe7a7d7e68f032f14c65ceabd8b5ad37838b53
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Nov 27 12:06:25 2016 +0100
tests: Add gir-test for fixed-size arrays
tests/Makefile.am | 1 +
tests/gir/array-fixed-length.test | 68 +++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1e6fd84..c94096d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -244,6 +244,7 @@ TESTS = \
gir/bug651773.test \
gir/bug667751.test \
gir/bug742012.test \
+ gir/array-fixed-length.test \
annotations/deprecated.vala \
annotations/description.vala \
$(NULL)
diff --git a/tests/gir/array-fixed-length.test b/tests/gir/array-fixed-length.test
new file mode 100644
index 0000000..0d7e70e
--- /dev/null
+++ b/tests/gir/array-fixed-length.test
@@ -0,0 +1,68 @@
+GIR
+
+Input:
+
+ <function name="get_array_return" c:identifier="test_get_array_return">
+ <return-value transfer-ownership="none">
+ <array zero-terminated="0" c:type="gpointer*" fixed-size="16">
+ <type name="guint8"/>
+ </array>
+ </return-value>
+ </function>
+
+ <function name="change_array" c:identifier="test_change_array">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="array"
+ direction="inout"
+ caller-allocates="1"
+ transfer-ownership="full">
+ <array zero-terminated="0" c:type="gpointer*" fixed-size="2">
+ <type name="guint8"/>
+ </array>
+ </parameter>
+ </parameters>
+ </function>
+
+ <function name="get_array_out" c:identifier="test_get_array_out">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="array"
+ direction="out"
+ caller-allocates="1"
+ transfer-ownership="full">
+ <array zero-terminated="0" c:type="gpointer*" fixed-size="8">
+ <type name="guint8"/>
+ </array>
+ </parameter>
+ </parameters>
+ </function>
+
+ <function name="set_array" c:identifier="test_set_array">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="array"
+ transfer-ownership="none">
+ <array zero-terminated="0" c:type="gpointer*" fixed-size="4">
+ <type name="guint8"/>
+ </array>
+ </parameter>
+ </parameters>
+ </function>
+
+Output:
+
+[CCode (cheader_filename = "test.h")]
+public static void change_array ([CCode (array_length = false)] ref uint8 array[2]);
+[CCode (cheader_filename = "test.h")]
+public static void get_array_out ([CCode (array_length = false)] out uint8 array[8]);
+[CCode (array_length = false, cheader_filename = "test.h")]
+public static unowned uint8[] get_array_return ();
+[CCode (cheader_filename = "test.h")]
+public static void set_array ([CCode (array_length = false)] uint8 array[4]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]