From 0a1cc4ca03d0452e0ab237e198b5057d53dba06c Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Wed, 24 Nov 2021 21:26:03 +0100 Subject: [PATCH] tests: Add [Profile] method test to increase coverage --- tests/Makefile.am | 1 + tests/methods/profile.vala | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/methods/profile.vala diff --git a/tests/Makefile.am b/tests/Makefile.am index 7fab0a41b..9b4feb1cd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -245,6 +245,7 @@ TESTS = \ methods/printf-invalid.test \ methods/printf-constructor.vala \ methods/printf-constructor-invalid.test \ + methods/profile.vala \ methods/varargs-delegate.vala \ methods/varargs-delegate-without-target.vala \ methods/varargs-gvalue.vala \ diff --git a/tests/methods/profile.vala b/tests/methods/profile.vala new file mode 100644 index 000000000..a99b377c9 --- /dev/null +++ b/tests/methods/profile.vala @@ -0,0 +1,19 @@ +[Profile] +void foo () { + Thread.usleep (4000); +} + +[Profile] +int bar (bool b) { + Thread.usleep (4000); + if (b) { + return 42; + } + return 23; +} + +void main () { + foo (); + assert (bar (false) == 23); + assert (bar (true) == 42); +} -- 2.47.2