m13129.nim 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # issue #13129
  2. when defined(cpp):
  3. {.push header: "<vector>".}
  4. type
  5. Vector[T] {.importcpp: "std::vector".} = object
  6. elif defined(js):
  7. proc endsWith*(s, suffix: cstring): bool {.noSideEffect,importjs: "#.endsWith(#)".}
  8. elif defined(c):
  9. proc c_printf*(frmt: cstring): cint {.
  10. importc: "printf", header: "<stdio.h>", varargs, discardable.}
  11. proc main*() =
  12. runnableExamples:
  13. import std/compilesettings
  14. doAssert not defined(m13129Foo1)
  15. doAssert defined(m13129Foo2)
  16. doAssert not defined(nimdoc)
  17. echo "ok2: backend: " & querySetting(backend)
  18. import std/compilesettings
  19. when defined nimdoc:
  20. static:
  21. doAssert defined(m13129Foo1)
  22. doAssert not defined(m13129Foo2)
  23. echo "ok1:" & querySetting(backend)
  24. when isMainModule:
  25. when not defined(js):
  26. import std/os
  27. let cache = querySetting(nimcacheDir)
  28. doAssert cache.len > 0
  29. let app = getAppFilename()
  30. doAssert app.isRelativeTo(cache), $(app, cache)
  31. doAssert querySetting(projectFull) == currentSourcePath
  32. echo "ok3"