]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "ThreadPool" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 3 May 2021 07:34:13 +0000 (09:34 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 3 May 2021 07:34:13 +0000 (09:34 +0200)
tests/Makefile.am
tests/threads/threadpool.vala [new file with mode: 0644]

index 281531d223e9d3835c455aaaa12ef8f250228fc6..998ca62dabf91ad4eb71182416ad0d237b81e758 100644 (file)
@@ -677,6 +677,7 @@ TESTS = \
        asynchronous/variadic-invalid.test \
        asynchronous/variadic-invalid-2.test \
        asynchronous/yield.vala \
+       threads/threadpool.vala \
        generics/arrays.vala \
        generics/arrays-not-supported.test \
        generics/arrays-not-supported-2.test \
diff --git a/tests/threads/threadpool.vala b/tests/threads/threadpool.vala
new file mode 100644 (file)
index 0000000..d47a782
--- /dev/null
@@ -0,0 +1,15 @@
+bool success = false;
+
+void main () {
+       try {
+               var pool = new ThreadPool<string>.with_owned_data ((s) => {
+                       assert (s == "foo" || s == "bar");
+                       success = true;
+               }, 2, true);
+               pool.add ("foo");
+               pool.add ("bar");
+       } catch {
+               assert_not_reached ();
+       }
+       assert (success);
+}