[vala/0.52] tests: Add [Profile] method test to increase coverage



commit 0a1cc4ca03d0452e0ab237e198b5057d53dba06c
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 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);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]