From 2a514d0969f5c25d5e2d14421125a47df6b14974 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 17 Nov 2017 16:06:54 +0100 Subject: Fix unit tests using async + read message marker --- xmpp-vala/src/module/message/module.vala | 5 +++-- xmpp-vala/tests/stanza.vala | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'xmpp-vala') diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala index 2ca06dc4..afa3f005 100644 --- a/xmpp-vala/src/module/message/module.vala +++ b/xmpp-vala/src/module/message/module.vala @@ -15,8 +15,9 @@ namespace Xmpp.Message { public signal void received_message(XmppStream stream, Message.Stanza message); public void send_message(XmppStream stream, Message.Stanza message) { - send_pipeline.run.begin(stream, message); - stream.write(message.stanza); + send_pipeline.run.begin(stream, message, (obj, res) => { + stream.write(message.stanza); + }); } public async void received_message_stanza_async(XmppStream stream, StanzaNode node) { diff --git a/xmpp-vala/tests/stanza.vala b/xmpp-vala/tests/stanza.vala index 1662c9bc..40b54a38 100644 --- a/xmpp-vala/tests/stanza.vala +++ b/xmpp-vala/tests/stanza.vala @@ -6,12 +6,12 @@ class StanzaTest : Gee.TestCase { public StanzaTest() { base("Stanza"); - add_test("node_one", test_node_one); - add_test("typical_stream", test_typical_stream); - add_test("ack_stream", test_ack_stream); + add_test("node_one", () => { test_node_one.begin(); }); + add_test("typical_stream", () => { test_typical_stream.begin(); }); + add_test("ack_stream", () => { test_ack_stream.begin(); }); } - private void test_node_one() { + private async void test_node_one() { var node1 = new StanzaNode.build("test", "ns1_uri") .add_self_xmlns() .put_attribute("ns2", "ns2_uri", XMLNS_URI) @@ -22,12 +22,12 @@ class StanzaTest : Gee.TestCase { .add_self_xmlns()); var xml1 = node1.to_xml(); - var node2 = new StanzaReader.for_string(xml1).read_node(); + var node2 = yield new StanzaReader.for_string(xml1).read_node(); fail_if_not(node1.equals(node2)); fail_if_not_eq_str(node1.to_string(), node2.to_string()); } - private void test_typical_stream() { + private async void test_typical_stream() { var stream = """ reader.read_node(), 3, "end of stream should be reached"); } - private void test_ack_stream() { + private async void test_ack_stream() { var stream = """ reader.read_node(), 3, "end of stream should be reached"); } -- cgit v1.2.3-70-g09d2