]> 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 07:05:10 +0000 (09:05 +0200)
tests/Makefile.am
tests/threads/threadpool.vala [new file with mode: 0644]

index d8f7d98bed95454691867b281ac86a80fc999966..8bcfebcccbbc8a856f9bb091de6fc8d3a63b438b 100644 (file)
@@ -657,6 +657,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);
+}