m13129.nim 1.0 KB

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