[vala/0.48] tests: Add [Profile] method test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] tests: Add [Profile] method test to increase coverage
- Date: Mon, 29 Nov 2021 13:06:02 +0000 (UTC)
commit 5a6a1e8897fe40693a227c7a6791ef537a29a510
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Nov 24 21:26:03 2021 +0100
tests: Add [Profile] method test to increase coverage
tests/Makefile.am | 1 +
tests/methods/profile.vala | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b40aa51a4..11e04ab85 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -243,6 +243,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);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]