diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2016-11-27 12:06:25 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2016-11-27 12:06:25 +0100 |
commit | 60fe7a7d7e68f032f14c65ceabd8b5ad37838b53 (patch) | |
tree | ed11beb63fecf70b24f70f68cf71f0c8cbea4a94 /tests | |
parent | 37ceb2dae28335c4b1e92c161f6d08debce43322 (diff) | |
download | vala-60fe7a7d7e68f032f14c65ceabd8b5ad37838b53.tar.gz |
tests: Add gir-test for fixed-size arrays
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | 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 1e6fd84c3..c94096d54 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 000000000..0d7e70ee5 --- /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]); |