From: Corentin Noël Date: Sun, 5 Apr 2020 12:25:29 +0000 (+0200) Subject: tests: Extend "DBus signals" test to increase coverage X-Git-Tag: 0.49.1~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fmerge-requests%2F122%2Fhead;p=thirdparty%2Fvala.git tests: Extend "DBus signals" test to increase coverage This adds code coverage for generating multiple signals, tests for arrays and ensures that the private signals are not leaking. --- diff --git a/tests/dbus/signals.test b/tests/dbus/signals.test index 10544c520..2ea689c67 100644 --- a/tests/dbus/signals.test +++ b/tests/dbus/signals.test @@ -6,8 +6,11 @@ Program: client [DBus (name = "org.example.Test")] interface Test : Object { public signal void foo (int i); + public signal void bar (string[] baz); + internal signal void finish (); - public abstract void do_foo (int i) throws IOError; + public abstract void do_foo (int i) throws DBusError, IOError; + public abstract void do_bar (string[] baz) throws DBusError, IOError; } MainLoop main_loop; @@ -18,10 +21,22 @@ void main () { test.foo.connect ((i) => { assert (i == 42); + }); + + test.bar.connect ((baz) => { + assert (baz.length == 3); + assert (baz[0] == "zero"); + assert (baz[1] == "one"); + assert (baz[2] == "two"); main_loop.quit (); }); + test.finish.connect (() => { + assert_not_reached (); + }); + test.do_foo (42); + test.do_bar ({"zero", "one", "two"}); main_loop = new MainLoop (); main_loop.run (); @@ -32,9 +47,16 @@ Program: server [DBus (name = "org.example.Test")] class Test : Object { public signal void foo (int i); + public signal void bar (string[] baz); + private signal void finish (); - public void do_foo (int i) { + public void do_foo (int i) throws DBusError, IOError { this.foo (i); + finish (); + } + + public void do_bar (string[] baz) throws DBusError, IOError { + this.bar (baz); } }