[vala/0.38] tests: Add chain-up regression test for real non-null struct parameters



commit 151456119d3a81c436a2efc03acfd02d84afcfe6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Dec 20 21:34:20 2017 +0100

    tests: Add chain-up regression test for real non-null struct parameters
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791785

 tests/Makefile.am            |    1 +
 tests/chainup/bug791785.vala |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f70ef1..571c9f2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -59,6 +59,7 @@ TESTS = \
        chainup/struct-base-foo.vala \
        chainup/struct-this.vala \
        chainup/struct-this-foo.vala \
+       chainup/bug791785.vala \
        pointers/bug590641.vala \
        namespaces.vala \
        methods/lambda.vala \
diff --git a/tests/chainup/bug791785.vala b/tests/chainup/bug791785.vala
new file mode 100644
index 0000000..eb46b01
--- /dev/null
+++ b/tests/chainup/bug791785.vala
@@ -0,0 +1,23 @@
+struct Foo {
+    public int i;
+}
+
+abstract class AbstractBar {
+       public Foo foo;
+
+       public AbstractBar (Foo foo) {
+               this.foo = foo;
+       }
+}
+
+class Bar : AbstractBar {
+       public Bar (Foo foo) {
+               base (foo);
+       }
+}
+
+void main () {
+       var bar = new Bar ({ 42 });
+       assert (bar.foo.i == 42);
+}
+


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