[vala/wip/issue/658: 48/48] Test optional anonymous delegate parameters
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/658: 48/48] Test optional anonymous delegate parameters
- Date: Sat, 31 Oct 2020 15:08:17 +0000 (UTC)
commit 9f756fa8fee593c6fd52598070dd9e098400f36a
Author: Nick Schrader <nick schrader mailbox org>
Date: Sat Oct 31 00:18:05 2020 -0300
Test optional anonymous delegate parameters
tests/Makefile.am | 1 +
tests/methods/parameter-anonymous-delegate-optional.vala | 8 ++++++++
2 files changed, 9 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bee6d7fd2..1a1a26e9b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -139,6 +139,7 @@ TESTS = \
methods/extern.vala \
methods/iterator.vala \
methods/parameter-anonymous-delegate.vala \
+ methods/parameter-anonymous-delegate-optional.vala \
methods/parameter-fixed-array-initializer.vala \
methods/parameter-ref-array-resize.vala \
methods/parameter-ref-array-resize-captured.vala \
diff --git a/tests/methods/parameter-anonymous-delegate-optional.vala
b/tests/methods/parameter-anonymous-delegate-optional.vala
new file mode 100644
index 000000000..dc6085b34
--- /dev/null
+++ b/tests/methods/parameter-anonymous-delegate-optional.vala
@@ -0,0 +1,8 @@
+int f (delegate(int) => int d = (a) => 2*a) {
+ return d (7);
+}
+
+void main () {
+ assert (f (a => a) == 7);
+ assert (f () == 14);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]