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

This commit is contained in:
flywind
2020-11-05 18:55:42 +08:00
committed by GitHub
parent fdd25ed19c
commit dfa2f011d7

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)