]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add [Profile] method test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 24 Nov 2021 20:26:03 +0000 (21:26 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 29 Nov 2021 12:41:42 +0000 (13:41 +0100)
tests/Makefile.am
tests/methods/profile.vala [new file with mode: 0644]

index b40aa51a4b6863d4ad63bb2cd20945e258c61b57..11e04ab858c58042e388d2f249326d4a518207a7 100644 (file)
@@ -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 (file)
index 0000000..a99b377
--- /dev/null
@@ -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);
+}