From dd8383b10acfc7242a1b60080866c5dc95179246 Mon Sep 17 00:00:00 2001 From: flywind Date: Mon, 8 Mar 2021 21:37:52 +0800 Subject: add testcase for #12005 (#17278) * remove unnecessary when statement * remove outdated codes * reuse jsffi * move js json coverage * close #12005 add testcase * Update tests/stdlib/tthreadpool.nim * Update tests/stdlib/tthreadpool.nim * Update tests/stdlib/tthreadpool.nim Co-authored-by: Timothee Cour Co-authored-by: Timothee Cour --- tests/stdlib/tthreadpool.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/stdlib/tthreadpool.nim (limited to 'tests/stdlib') diff --git a/tests/stdlib/tthreadpool.nim b/tests/stdlib/tthreadpool.nim new file mode 100644 index 000000000..897c7d173 --- /dev/null +++ b/tests/stdlib/tthreadpool.nim @@ -0,0 +1,14 @@ +discard """ + matrix: "--threads:on --gc:arc" + disabled: "freebsd" + output: "42" +""" + +from std/threadpool import spawn, `^`, sync +block: # bug #12005 + proc doworkok(i: int) {.thread.} = echo i + spawn(doworkok(42)) + sync() # this works when returning void! + + proc doworkbad(i: int): int {.thread.} = i + doAssert ^spawn(doworkbad(42)) == 42 # bug was here -- cgit 1.4.1-2-gfad0