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



commit 4b83759d81327dfac83198f8ebd2aa8942594b9f
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 77f144ca2..2951db733 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -624,6 +624,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 \
@@ -633,6 +634,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]