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



commit 61e9dacbaca03af24ea2e7a636fa68c7396f2006
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 2ecc783ac..85cce4601 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
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]