[vala/0.52] tests: Add "ThreadPool" test to increase coverage



commit 22e12d2e572386bc7e543138b38ecda9be1036ed
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon May 3 09:34:13 2021 +0200

    tests: Add "ThreadPool" test to increase coverage

 tests/Makefile.am             |  1 +
 tests/threads/threadpool.vala | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2cee6fe79..0aa268978 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -674,6 +674,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
index 000000000..d47a78266
--- /dev/null
+++ b/tests/threads/threadpool.vala
@@ -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);
+}


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