]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "throws error code" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Oct 2021 16:27:29 +0000 (18:27 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 Oct 2021 12:19:55 +0000 (14:19 +0200)
tests/Makefile.am
tests/errors/delegate-throws-error-code.vala [new file with mode: 0644]
tests/errors/method-throws-error-code.vala [new file with mode: 0644]

index 77f144ca2b58bb4ff451353fc5aa43216c717d9c..2951db733a12c81aba6545d8a49b02c0f4f445a5 100644 (file)
@@ -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 (file)
index 0000000..c06ed15
--- /dev/null
@@ -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 (file)
index 0000000..dbe2d92
--- /dev/null
@@ -0,0 +1,11 @@
+errordomain FooError {
+       FOO,
+       BAR;
+}
+
+void foo () throws FooError.BAR {
+}
+
+void main () {
+       foo ();
+}