[vala/wip/issue/658: 33/34] Test optional anonymous delegate parameters




commit 12625d4a3c75400972afc98f27ea43ca2c3e71e6
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 38f924e77..b43ab00b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -157,6 +157,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]