tstackframes.nim 981 B

1234567891011121314151617181920212223242526272829303132333435
  1. import std/[strformat,os,osproc]
  2. import stdtest/unittest_light
  3. proc main(opt: string, expected: string) =
  4. const nim = getCurrentCompilerExe()
  5. const file = currentSourcePath().parentDir / "mstackframes.nim"
  6. let cmd = fmt"{nim} c -r --excessiveStackTrace:off --stacktraceMsgs:{opt} --hints:off {file}"
  7. let (output, exitCode) = execCmdEx(cmd)
  8. assertEquals output, expected
  9. doAssert exitCode == 0
  10. main("on"): """
  11. mstackframes.nim(38) mstackframes
  12. mstackframes.nim(29) main
  13. z: 0
  14. z: 1
  15. mstackframes.nim(20) main2 ("main2", 5, 1)
  16. mstackframes.nim(20) main2 ("main2", 4, 2)
  17. mstackframes.nim(20) main2 ("main2", 3, 3)
  18. mstackframes.nim(19) main2 ("main2", 2, 4)
  19. mstackframes.nim(18) bar ("bar ",)
  20. """
  21. main("off"): """
  22. mstackframes.nim(38) mstackframes
  23. mstackframes.nim(29) main
  24. mstackframes.nim(20) main2
  25. mstackframes.nim(20) main2
  26. mstackframes.nim(20) main2
  27. mstackframes.nim(19) main2
  28. mstackframes.nim(18) bar
  29. """