From: Rico Tzschichholz Date: Mon, 3 May 2021 07:34:13 +0000 (+0200) Subject: tests: Add "ThreadPool" test to increase coverage X-Git-Tag: 0.50.9~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61e9dacbaca03af24ea2e7a636fa68c7396f2006;p=thirdparty%2Fvala.git tests: Add "ThreadPool" test to increase coverage --- 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.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); +}