t8241.nim 619 B

123456789101112131415161718192021222324252627282930313233
  1. discard """
  2. targets: "cpp"
  3. action: "compile"
  4. """
  5. proc foo(): cstring {.importcpp: "", dynlib: "".}
  6. echo foo()
  7. ## bug #9222
  8. import os
  9. import amodule
  10. proc findlib2: string =
  11. let path = getEnv("MYLIB2_DOES_NOT_EXIST_PATH")
  12. if path.len > 0 and dirExists(path):
  13. path / "alib_does_not_matter.dll"
  14. else:
  15. "alib_does_not_matter.dll"
  16. proc imported_func2*(a: cint): cstring {.importc, dynlib: findlib2().}
  17. echo imported_func(1)
  18. echo imported_func2(1)
  19. # issue #8946
  20. from json import JsonParsingError
  21. import marshal
  22. const nothing = ""
  23. doAssertRaises(JsonParsingError):
  24. var bar = marshal.to[int](nothing)