summary refs log tree commit diff stats
path: root/tests/coroutines/twait.nim
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-21 10:31:47 -0600
committerGitHub <noreply@github.com>2021-01-21 17:31:47 +0100
commitdfe67970235d2c270a4fe91a7ba4451102d8eaac (patch)
treefe6b9e640884a43fb2d80eae675538d7b3ce0d0a /tests/coroutines/twait.nim
parent57d5c1465a576e2d8bfc6496946aa24183c4456d (diff)
downloadNim-dfe67970235d2c270a4fe91a7ba4451102d8eaac.tar.gz
fix #15628 (#16387)
* done

* Apply suggestions from code review

* fixup

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Diffstat (limited to 'tests/coroutines/twait.nim')
-rw-r--r--tests/coroutines/twait.nim34
1 files changed, 21 insertions, 13 deletions
diff --git a/tests/coroutines/twait.nim b/tests/coroutines/twait.nim
index 348007afb..71782ece1 100644
--- a/tests/coroutines/twait.nim
+++ b/tests/coroutines/twait.nim
@@ -1,20 +1,28 @@
 discard """
   output: "Exit 1\nExit 2"
-  targets: "c"
+  matrix: "--gc:refc; --gc:arc; --gc:orc"
+  target: "c"
 """
-import coro
 
-var coro1: CoroutineRef
+when compileOption("gc", "refc") or not defined(openbsd):
+  # xxx openbsd failed, see tgc.nim
+  import coro
 
-proc testCoroutine1() =
-  for i in 0..<10:
-    suspend(0)
-  echo "Exit 1"
+  var coro1: CoroutineRef
 
-proc testCoroutine2() =
-  coro1.wait()
-  echo "Exit 2"
+  proc testCoroutine1() =
+    for i in 0..<10:
+      suspend(0)
+    echo "Exit 1"
+
+  proc testCoroutine2() =
+    coro1.wait()
+    echo "Exit 2"
 
-coro1 = coro.start(testCoroutine1)
-coro.start(testCoroutine2)
-run()
+  coro1 = coro.start(testCoroutine1)
+  coro.start(testCoroutine2)
+  run()
+else:
+  # workaround
+  echo "Exit 1"
+  echo "Exit 2"