mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
(cherry picked from commit dfa2f011d7)
This commit is contained in:
23
tests/magics/t10307.nim
Normal file
23
tests/magics/t10307.nim
Normal 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)
|
||||
Reference in New Issue
Block a user