From c424722da4eafd9d75fff3220c764a11566d5dc0 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sun, 4 Dec 2016 19:52:40 +0100 Subject: [PATCH] tests: Add chain-up lambda regression test https://bugzilla.gnome.org/show_bug.cgi?id=567269 --- tests/Makefile.am | 1 + tests/chainup/method-lambda-base.vala | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/chainup/method-lambda-base.vala diff --git a/tests/Makefile.am b/tests/Makefile.am index 91769abfd..722547848 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -61,6 +61,7 @@ TESTS = \ chainup/class-object.vala \ chainup/class-this.vala \ chainup/class-this-foo.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 000000000..b9623842a --- /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); +} -- 2.47.2