[vala/0.40] tests: Add "signal error marshalling" test to increase coverage



commit 913d59b1fefadba706cd5373cf6d9bd02c763a0e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Jul 20 10:37:53 2020 +0200

    tests: Add "signal error marshalling" test to increase coverage

 tests/Makefile.am                        |  1 +
 tests/objects/signals-error-marshal.vala | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fac3963cd..9de634953 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -371,6 +371,7 @@ TESTS = \
        objects/signals-delegate.vala \
        objects/signals-delegate-parameter.vala \
        objects/signals-dymanic-invalid-handler.test \
+       objects/signals-error-marshal.vala \
        objects/signals-fundamental-return.vala \
        objects/signals-gobject-return.vala \
        objects/signals-prototype-access.vala \
diff --git a/tests/objects/signals-error-marshal.vala b/tests/objects/signals-error-marshal.vala
new file mode 100644
index 000000000..b727777e2
--- /dev/null
+++ b/tests/objects/signals-error-marshal.vala
@@ -0,0 +1,26 @@
+errordomain FooError {
+       BAD;
+}
+
+struct Bar {
+       public int i;
+}
+
+class Foo : GLib.Object {
+       signal void foo (void* p, Bar bar);
+       signal void bar (void* p, Error e);
+
+       public Foo () {
+               bar.connect (callback);
+               bar (null, new FooError.BAD ("bad"));
+       }
+
+       void callback (void* p, Error e) {
+               assert (p == null);
+               assert (e.code == FooError.BAD);
+       }
+}
+
+void main() {
+       var foo = new Foo ();
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]