[vala/0.42] tests: Add "null-terminated array" delegate test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] tests: Add "null-terminated array" delegate test to increase coverage
- Date: Thu, 28 Feb 2019 07:28:27 +0000 (UTC)
commit 0a3ae3c434d1a89315be1dac2c10c134629ccf8b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Feb 23 20:19:31 2019 +0100
tests: Add "null-terminated array" delegate test to increase coverage
tests/Makefile.am | 1 +
tests/delegates/return-array-null-terminated.vala | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 51e71d2fd..b5fe150f8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -235,6 +235,7 @@ TESTS = \
delegates/fields-no-target.vala \
delegates/instance-method-to-no-target.test \
delegates/reference_transfer.vala \
+ delegates/return-array-null-terminated.vala \
delegates/wrapper.vala \
delegates/bug519949.test \
delegates/bug539166.vala \
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");
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]