]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add chain-up lambda regression test c424722da4eafd9d75fff3220c764a11566d5dc0
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 4 Dec 2016 18:52:40 +0000 (19:52 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 19 Feb 2018 10:52:38 +0000 (11:52 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=567269

tests/Makefile.am
tests/chainup/method-lambda-base.vala [new file with mode: 0644]

index 91769abfd575b30d68d86fdaee0f1fb50a6821f5..72254784830ff4d644ad0975a85c6fdc257a3ad0 100644 (file)
@@ -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 (file)
index 0000000..b962384
--- /dev/null
@@ -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);
+}