From 70a38ef2416b90400796e76e94064ef8b99b2faa Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sat, 23 Oct 2021 18:27:29 +0200 Subject: [PATCH] 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(+) create mode 100644 tests/errors/delegate-throws-error-code.vala create mode 100644 tests/errors/method-throws-error-code.vala 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 (); +} -- 2.47.2