From: Rico Tzschichholz Date: Sun, 4 Dec 2016 18:52:40 +0000 (+0100) Subject: tests: Add chain-up lambda regression test X-Git-Tag: 0.39.92~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c424722da4eafd9d75fff3220c764a11566d5dc0;p=thirdparty%2Fvala.git tests: Add chain-up lambda regression test https://bugzilla.gnome.org/show_bug.cgi?id=567269 --- 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); +}