summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-03-17 17:08:54 +0800
committerGitHub <noreply@github.com>2021-03-17 10:08:54 +0100
commite9b5543bd503ffebbd7fc4b5328d8a9c69419908 (patch)
tree3f04a474ec18028f39ef199fc4b6c04f9f90c647 /tests
parentbebf2ce24a43bef4cde5c90c4010631a1e4a7927 (diff)
downloadNim-e9b5543bd503ffebbd7fc4b5328d8a9c69419908.tar.gz
[std/channels]fix recv leaks(Part One) (#17394)
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tchannels_pthread.nim3
-rw-r--r--tests/stdlib/tchannels_simple.nim3
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/stdlib/tchannels_pthread.nim b/tests/stdlib/tchannels_pthread.nim
index a9708d8fb..3bc000551 100644
--- a/tests/stdlib/tchannels_pthread.nim
+++ b/tests/stdlib/tchannels_pthread.nim
@@ -89,6 +89,7 @@ proc runSuite(
         capacity(chan) == 1
         isBuffered(chan) == false
         isUnbuffered(chan) == true
+
     else:
       chan = allocChannel(size = int.sizeof.int, n = 7)
       check:
@@ -109,7 +110,7 @@ proc runSuite(
       discard pthread_join(threads[0], nil)
       discard pthread_join(threads[1], nil)
 
-      freeChannel(chan)
+    freeChannel(chan)
 
 # ----------------------------------------------------------------------------------
 
diff --git a/tests/stdlib/tchannels_simple.nim b/tests/stdlib/tchannels_simple.nim
index dc4857c3e..56e5fb8f1 100644
--- a/tests/stdlib/tchannels_simple.nim
+++ b/tests/stdlib/tchannels_simple.nim
@@ -24,8 +24,7 @@ var worker1: Thread[void]
 createThread(worker1, firstWorker)
 
 # Block until the message arrives, then print it out.
-var dest = ""
-chan.recv(dest)
+let dest = chan.recv()
 doAssert dest == "Hello World!"
 
 # Wait for the thread to exit before moving on to the next example.