t10307.nim 378 B

12345678910111213141516171819202122232425
  1. discard """
  2. cmd: "nim c --mm:refc -d:useGcAssert $file"
  3. output: '''running someProc(true)
  4. res: yes
  5. yes
  6. running someProc(false)
  7. res:
  8. '''
  9. """
  10. proc someProc(x:bool):cstring =
  11. var res:string = ""
  12. if x:
  13. res = "yes"
  14. echo "res: ", res
  15. GC_ref(res)
  16. result = res
  17. echo "running someProc(true)"
  18. echo someProc(true)
  19. echo "running someProc(false)"
  20. echo someProc(false)