]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "finish_instance = false" test-case
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 6 Mar 2017 07:51:51 +0000 (08:51 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 6 Mar 2017 13:21:08 +0000 (14:21 +0100)
Also references IOSteam.splice_async() as compilation check.

https://bugzilla.gnome.org/show_bug.cgi?id=710103

tests/Makefile.am
tests/asynchronous/bug710103.vala [new file with mode: 0644]

index cd9f5695a458f326ed8d2aaa5217e4019195bc1d..132b0b539fe9094df0910715a49b056d6f65b135 100644 (file)
@@ -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 (file)
index 0000000..b6395e3
--- /dev/null
@@ -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 ();
+}