[vala/staging] tests: Add chain-up lambda regression test
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] tests: Add chain-up lambda regression test
- Date: Mon, 19 Feb 2018 10:53:53 +0000 (UTC)
commit c424722da4eafd9d75fff3220c764a11566d5dc0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Dec 4 19:52:40 2016 +0100
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(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 91769ab..7225478 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 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]