[vala/0.34] tests: Add "finish_instance = false" test-case



commit 6c5bcc512c0c9ab8e3ea2c8fc2bcff4088867259
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Mar 6 08:51:51 2017 +0100

    tests: Add "finish_instance = false" test-case
    
    Also references IOSteam.splice_async() as compilation check.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710103

 tests/Makefile.am                 |    1 +
 tests/asynchronous/bug710103.vala |   43 +++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2889ffe..7965926 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -222,6 +222,7 @@ TESTS = \
        asynchronous/bug654337.vala \
        asynchronous/bug659886.vala \
        asynchronous/bug661961.vala \
+       asynchronous/bug710103.vala \
        asynchronous/bug741929.vala \
        asynchronous/bug742621.vala \
        asynchronous/bug762819.vala \
diff --git a/tests/asynchronous/bug710103.vala b/tests/asynchronous/bug710103.vala
new file mode 100644
index 0000000..b6395e3
--- /dev/null
+++ b/tests/asynchronous/bug710103.vala
@@ -0,0 +1,43 @@
+void iostream () {
+       IOStream? is0 = null;
+       IOStream? is1 = null;
+       is0.splice_async.begin (is1, IOStreamSpliceFlags.NONE, Priority.DEFAULT, null, (obj, res) => {
+               try {
+                       is0.splice_async.end (res);
+               } catch (Error e) {
+               }
+       });
+}
+
+class Foo : Object {
+       public int manam;
+
+       [CCode (finish_instance = false)]
+       public async void bar () {
+               manam = 23;
+       }
+
+       [CCode (finish_instance = false)]
+       public async Foo.@async () {
+               manam = 42;
+       }
+
+       public static async Foo create_foo_async () {
+               var foo = yield new Foo.@async ();
+               return foo;
+       }
+}
+
+void main () {
+       var loop = new MainLoop ();
+       Foo.create_foo_async.begin ((obj,res) => {
+               var foo = Foo.create_foo_async.end (res);
+               assert (foo.manam == 42);
+               foo.bar.begin ((obj, res) => {
+                       foo.bar.end (res);
+                       assert (foo.manam == 23);
+                       loop.quit ();
+               });
+       });
+       loop.run ();
+}


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