[vala/wip/bug567269: 1197/1197] tests: Add chain-up lambda regression test



commit 4271ad33d56e59b7ba2a0566ab3ac333738c274e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Dec 4 19:52:40 2016 +0100

    tests: Add chain-up lambda regression test

 tests/Makefile.am                     |    1 +
 tests/chainup/method-lambda-base.vala |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 41c09a9..0a3be33 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,6 +62,7 @@ TESTS = \
        chainup/class-this.vala \
        chainup/class-this-foo.vala \
        chainup/class-with-lambda.vala \
+       chainup/method-lambda-base.vala \
        chainup/no-chainup.vala \
        chainup/struct-base.vala \
        chainup/struct-base-foo.vala \
diff --git a/tests/chainup/method-lambda-base.vala b/tests/chainup/method-lambda-base.vala
new file mode 100644
index 0000000..b962384
--- /dev/null
+++ b/tests/chainup/method-lambda-base.vala
@@ -0,0 +1,26 @@
+public delegate void Func ();
+
+public class Foo {
+       public int i;
+       public virtual void foo () {
+               i = 1;
+       }
+}
+
+public class Bar : Foo {
+       void execute (Func func) {
+               func ();
+       }
+
+       public override void foo () {
+               execute (() => {
+                       base.foo ();
+               });
+       }
+}
+
+void main () {
+       var bar = new Bar ();
+       bar.foo ();
+       assert (bar.i == 1);
+}


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