close #10307(add testcase for #10307) (#15840)

(cherry picked from commit dfa2f011d7)
This commit is contained in:
flywind
2020-11-05 18:55:42 +08:00
committed by narimiran
parent b100c67515
commit 5bc573cf1e

23
tests/magics/t10307.nim Normal file
View File

@@ -0,0 +1,23 @@
discard """
cmd: "nim c -d:useGcAssert $file"
output: '''running someProc(true)
res: yes
yes
running someProc(false)
res:
'''
"""
proc someProc(x:bool):cstring =
var res:string = ""
if x:
res = "yes"
echo "res: ", res
GC_ref(res)
result = res
echo "running someProc(true)"
echo someProc(true)
echo "running someProc(false)"
echo someProc(false)