From: Rico Tzschichholz Date: Mon, 6 Mar 2017 07:51:51 +0000 (+0100) Subject: tests: Add "finish_instance = false" test-case X-Git-Tag: 0.35.7~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4796cc50eee4b70b674e8c0d045f79f2d6c26f98;p=thirdparty%2Fvala.git tests: Add "finish_instance = false" test-case Also references IOSteam.splice_async() as compilation check. https://bugzilla.gnome.org/show_bug.cgi?id=710103 --- diff --git a/tests/Makefile.am b/tests/Makefile.am index cd9f5695a..132b0b539 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 000000000..b6395e351 --- /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 (); +}