summary refs log tree commit diff stats
path: root/tests/async/tasyncall.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/async/tasyncall.nim')
-rw-r--r--tests/async/tasyncall.nim26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/async/tasyncall.nim b/tests/async/tasyncall.nim
index 7daecd9ef..775dd0c6f 100644
--- a/tests/async/tasyncall.nim
+++ b/tests/async/tasyncall.nim
@@ -40,8 +40,17 @@ proc testVarargs(x, y, z: int): seq[int] =
 
   result = waitFor all(a, b, c)
 
-suite "tasyncall":
-  test "testFuturesWithValue":
+proc testWithDupes() =
+  var
+    tasks = newSeq[Future[void]](taskCount)
+    fut = futureWithoutValue()
+
+  for i in 0..<taskCount:
+    tasks[i] = fut
+
+  waitFor all(tasks)
+
+block:
     let
       startTime = cpuTime()
       results = testFuturesWithValue(42)
@@ -51,14 +60,21 @@ suite "tasyncall":
     doAssert execTime * 1000 < taskCount * sleepDuration
     doAssert results == expected
 
-  test "testFuturesWithoutValues":
+block:
     let startTime = cpuTime()
     testFuturesWithoutValues()
     let execTime = cpuTime() - startTime
 
     doAssert execTime * 1000 < taskCount * sleepDuration
 
-  test "testVarargs":
+block:
+    let startTime = cpuTime()
+    testWithDupes()
+    let execTime = cpuTime() - startTime
+
+    doAssert execTime * 1000 < taskCount * sleepDuration
+
+block:
     let
       startTime = cpuTime()
       results = testVarargs(1, 2, 3)
@@ -68,7 +84,7 @@ suite "tasyncall":
     doAssert execTime * 100 < taskCount * sleepDuration
     doAssert results == expected
 
-  test "all on seq[Future]":
+block:
     let
       noIntFuturesFut = all(newSeq[Future[int]]())
       noVoidFuturesFut = all(newSeq[Future[void]]())