summary refs log tree commit diff stats
path: root/tests/stdlib/ttasks.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/ttasks.nim')
-rw-r--r--tests/stdlib/ttasks.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/stdlib/ttasks.nim b/tests/stdlib/ttasks.nim
index 4889d49d9..347c3347a 100644
--- a/tests/stdlib/ttasks.nim
+++ b/tests/stdlib/ttasks.nim
@@ -505,3 +505,21 @@ block:
       b.invoke()
 
     doAssert called == 36
+
+  block:
+    proc returnsSomething(a, b: int): int = a + b
+
+    proc noArgsButReturnsSomething(): string = "abcdef"
+
+    proc testReturnValues() =
+      let t = toTask returnsSomething(2233, 11)
+      var res: int
+      t.invoke(addr res)
+      doAssert res == 2233+11
+
+      let tb = toTask noArgsButReturnsSomething()
+      var resB: string
+      tb.invoke(addr resB)
+      doAssert resB == "abcdef"
+
+    testReturnValues()