[vala/0.48] tests: Add "throws error code" tests to increase coverage



commit 70a38ef2416b90400796e76e94064ef8b99b2faa
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Oct 23 18:27:29 2021 +0200

    tests: Add "throws error code" tests to increase coverage

 tests/Makefile.am                            |  2 ++
 tests/errors/delegate-throws-error-code.vala | 11 +++++++++++
 tests/errors/method-throws-error-code.vala   | 11 +++++++++++
 3 files changed, 24 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6822f2a70..5e151ac7c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -606,6 +606,7 @@ TESTS = \
        errors/catch-in-finally.vala \
        errors/catch-no-error-type.test \
        errors/default-gtype.vala \
+       errors/delegate-throws-error-code.vala \
        errors/delegate-throws-no-error-type.test \
        errors/errors.vala \
        errors/errorcode.vala \
@@ -615,6 +616,7 @@ TESTS = \
        errors/invalid-type-check.test \
        errors/loops.vala \
        errors/method-throws.vala \
+       errors/method-throws-error-code.vala \
        errors/method-throws-no-error-type.test \
        errors/unhandled.vala \
        errors/bug567181.vala \
diff --git a/tests/errors/delegate-throws-error-code.vala b/tests/errors/delegate-throws-error-code.vala
new file mode 100644
index 000000000..c06ed15e1
--- /dev/null
+++ b/tests/errors/delegate-throws-error-code.vala
@@ -0,0 +1,11 @@
+errordomain FooError {
+       FOO,
+       BAR;
+}
+
+delegate void FooFunc () throws FooError.BAR;
+
+void main () {
+       FooFunc foo = () => {};
+       foo ();
+}
diff --git a/tests/errors/method-throws-error-code.vala b/tests/errors/method-throws-error-code.vala
new file mode 100644
index 000000000..dbe2d92b8
--- /dev/null
+++ b/tests/errors/method-throws-error-code.vala
@@ -0,0 +1,11 @@
+errordomain FooError {
+       FOO,
+       BAR;
+}
+
+void foo () throws FooError.BAR {
+}
+
+void main () {
+       foo ();
+}


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