diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-05-11 03:01:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 12:01:18 +0200 |
commit | 9502e39b634eea8e04f07ddc110b466387f42322 (patch) | |
tree | 240ffa98d6f1d556986dccbb66e9f5e0e81675e4 /tests/nimdoc | |
parent | d11cb9d49596957e9fa097110cf19e9caf085592 (diff) | |
download | Nim-9502e39b634eea8e04f07ddc110b466387f42322.tar.gz |
`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
Diffstat (limited to 'tests/nimdoc')
-rw-r--r-- | tests/nimdoc/m13129.nim | 36 | ||||
-rw-r--r-- | tests/nimdoc/readme.md | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/nimdoc/m13129.nim b/tests/nimdoc/m13129.nim new file mode 100644 index 000000000..df4b5a3f5 --- /dev/null +++ b/tests/nimdoc/m13129.nim @@ -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" diff --git a/tests/nimdoc/readme.md b/tests/nimdoc/readme.md new file mode 100644 index 000000000..64b16c2a5 --- /dev/null +++ b/tests/nimdoc/readme.md @@ -0,0 +1,2 @@ +the html validation is tested by nimdoc/tester.nim +the runnableExamples + nim doc logic (across backend) is tested here |