tevalffi.nim 629 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. joinable: false
  3. """
  4. import std/[strformat,os,osproc]
  5. proc main() =
  6. const nim = getCurrentCompilerExe()
  7. const file = currentSourcePath().parentDir / "mevalffi.nim"
  8. # strangely, --hint:cc:off was needed
  9. let cmd = fmt"{nim} c -f --experimental:compiletimeFFI --hints:off --hint:cc:off {file}"
  10. let (output, exitCode) = execCmdEx(cmd)
  11. let expected = """
  12. hello world stderr
  13. hi stderr
  14. foo
  15. foo:100
  16. foo:101
  17. foo:102:103
  18. foo:102:103:104
  19. foo:0.03:asdf:103:105
  20. ret={s1:foobar s2:foobar age:25 pi:3.14}
  21. """
  22. doAssert output == expected, output
  23. doAssert exitCode == 0
  24. when defined(nimHasLibFFIEnabled):
  25. main()