]> 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>
Wed, 19 May 2021 06:52:31 +0000 (08:52 +0200)
tests/Makefile.am
tests/threads/threadpool.vala [new file with mode: 0644]

index 2ecc783acc766d9f0bca1ee3135932c82fcf6ece..85cce460149ed6fe6a71769181b233ad53f4ad5c 100644 (file)
@@ -666,6 +666,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);
+}