[vala/0.40] tests: Extend "DBus signals" test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] tests: Extend "DBus signals" test to increase coverage
- Date: Tue, 21 Apr 2020 07:49:14 +0000 (UTC)
commit e2a0a6cdd8caa4f02b2c437a5a7393751544a736
Author: Corentin Noël <corentin elementary io>
Date: Sun Apr 5 14:25:29 2020 +0200
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.
tests/dbus/signals.test | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
---
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]