nim doc --backend:js, nim doc --doccmd:-d:foo, nim r --backend:js, --doccmd:skip + other improvements (#14278)
* `nim doc --backend:js|cpp...` `nim doc --doccmd:'-d:foo --threads:on'` `nim r --backend:cpp...` (implies --run --usenimcache) * --usenimcache works with all targets * --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
This commit is contained in:
parent
d11cb9d495
commit
9502e39b63
22 changed files with 213 additions and 99 deletions
36
tests/nimdoc/m13129.nim
Normal file
36
tests/nimdoc/m13129.nim
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
when defined(cpp):
|
||||
{.push header: "<vector>".}
|
||||
type
|
||||
Vector[T] {.importcpp: "std::vector".} = object
|
||||
elif defined(js):
|
||||
proc endsWith*(s, suffix: cstring): bool {.noSideEffect,importjs: "#.endsWith(#)".}
|
||||
elif defined(c):
|
||||
proc c_printf*(frmt: cstring): cint {.
|
||||
importc: "printf", header: "<stdio.h>", varargs, discardable.}
|
||||
|
||||
proc main*() =
|
||||
runnableExamples:
|
||||
import std/compilesettings
|
||||
doAssert not defined(m13129Foo1)
|
||||
doAssert defined(m13129Foo2)
|
||||
doAssert not defined(nimdoc)
|
||||
echo "ok2: backend: " & querySetting(backend)
|
||||
# echo defined(c), defined(js),
|
||||
|
||||
import std/compilesettings
|
||||
when defined nimdoc:
|
||||
# import std/compilesettings
|
||||
static:
|
||||
doAssert defined(m13129Foo1)
|
||||
doAssert not defined(m13129Foo2)
|
||||
echo "ok1:" & querySetting(backend)
|
||||
|
||||
when isMainModule:
|
||||
when not defined(js):
|
||||
import std/os
|
||||
let cache = querySetting(nimcacheDir)
|
||||
doAssert cache.len > 0
|
||||
let app = getAppFilename()
|
||||
doAssert app.isRelativeTo(cache)
|
||||
doAssert querySetting(projectFull) == currentSourcePath
|
||||
echo "ok3"
|
||||
2
tests/nimdoc/readme.md
Normal file
2
tests/nimdoc/readme.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
the html validation is tested by nimdoc/tester.nim
|
||||
the runnableExamples + nim doc logic (across backend) is tested here
|
||||
Loading…
Add table
Add a link
Reference in a new issue