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

This commit is contained in:
flywind 2020-11-05 18:55:42 +08:00 • committed by GitHub
commit dfa2f011d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)