[vala/wip/issue/658: 30/30] Add tests cases




commit 806463cdfd51991a4e3e6b7e8a3bbaaca89e2091
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 8 09:15:49 2020 +0200

    Add tests cases

 tests/Makefile.am                               |  1 +
 tests/methods/parameter-anonymous-delegate.vala | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ca795818a..5a06d631c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -136,6 +136,7 @@ TESTS = \
        methods/contains.vala \
        methods/extern.vala \
        methods/iterator.vala \
+       methods/parameter-anonymous-delegate.vala \
        methods/parameter-fixed-array-initializer.vala \
        methods/parameter-ref-array-resize.vala \
        methods/prepostconditions.vala \
diff --git a/tests/methods/parameter-anonymous-delegate.vala b/tests/methods/parameter-anonymous-delegate.vala
new file mode 100644
index 000000000..0b34b6945
--- /dev/null
+++ b/tests/methods/parameter-anonymous-delegate.vala
@@ -0,0 +1,21 @@
+int func (int a, int b) {
+       return a + b;
+}
+
+void foo (delegate(int, int) => int p, int r) {
+       assert (p (23, 42) == r);
+}
+
+void bar (int r, owned delegate(int, int) => int p) {
+       assert (p (23, 42) == r);
+}
+
+void manam ([CCode (has_target = false)] delegate(int, int) => int p, int r) {
+       assert (p (23, 42) == r);
+}
+
+void main() {
+       foo (func, 65);
+       bar (65, func);
+       manam (func, 65);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]