summaryrefslogtreecommitdiff
path: root/tests/delegates
diff options
context:
space:
mode:
Diffstat (limited to 'tests/delegates')
-rw-r--r--tests/delegates/return-array-null-terminated.vala17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/delegates/return-array-null-terminated.vala b/tests/delegates/return-array-null-terminated.vala
new file mode 100644
index 000000000..8918b3e55
--- /dev/null
+++ b/tests/delegates/return-array-null-terminated.vala
@@ -0,0 +1,17 @@
+[CCode (has_target = false, array_length = false, array_null_terminated = true)]
+delegate string[] FooFunc ();
+
+[CCode (array_length = false, array_null_terminated = true)]
+string[] foo () {
+ return {"foo", "bar"};
+}
+
+void main () {
+ FooFunc f = foo;
+
+ {
+ var s = f ();
+ assert (s.length == 2);
+ assert (s[1] == "bar");
+ }
+}