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



commit 4796cc50eee4b70b674e8c0d045f79f2d6c26f98
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 cd9f569..132b0b5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -246,6 +246,7 @@ TESTS = \
        asynchronous/bug654337.vala \
        asynchronous/bug659886.vala \
        asynchronous/bug661961.vala \
+       asynchronous/bug710103.vala \
        asynchronous/bug742621.vala \
        asynchronous/bug762819.vala \
        asynchronous/bug777242.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]