Add docgen runs in tests
Fix paths import Skip docgen for rsa for now
This commit is contained in:
parent
418e5db825
commit
63367a16a5
4 changed files with 16 additions and 7 deletions
|
|
@ -12,14 +12,21 @@ installDirs = @["nimterop"]
|
|||
requires "nim >= 0.20.2", "regex >= 0.14.1", "cligen >= 0.9.45"
|
||||
|
||||
import nimterop/docs
|
||||
import os
|
||||
|
||||
proc execCmd(cmd: string) =
|
||||
exec "tests/timeit " & cmd
|
||||
|
||||
proc execTest(test: string, flags = "") =
|
||||
proc execTest(test: string, flags = "", runDocs = true) =
|
||||
execCmd "nim c --hints:off -f " & flags & " -r " & test
|
||||
execCmd "nim cpp --hints:off " & flags & " -r " & test
|
||||
|
||||
if runDocs:
|
||||
let docPath = "build/html_" & test.extractFileName.changeFileExt("") & "_docs"
|
||||
rmDir docPath
|
||||
mkDir docPath
|
||||
buildDocs(@[test], docPath, compilerArgs = flags)
|
||||
|
||||
task buildToast, "build toast":
|
||||
execCmd("nim c --hints:off nimterop/toast.nim")
|
||||
|
||||
|
|
@ -54,8 +61,8 @@ task test, "Test":
|
|||
execTest "tests/tpcre.nim", "-d:FLAGS=\"-f:ast2\""
|
||||
|
||||
when defined(Linux):
|
||||
execTest "tests/rsa.nim"
|
||||
execTest "tests/rsa.nim", "-d:FLAGS=\"-H\""
|
||||
execTest "tests/rsa.nim", runDocs = false
|
||||
execTest "tests/rsa.nim", "-d:FLAGS=\"-H\"", runDocs = false
|
||||
|
||||
# Platform specific tests
|
||||
when defined(Windows):
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ proc cAddSearchDir*(dir: string) {.compileTime.} =
|
|||
## Add directory `dir` to the search path used in calls to
|
||||
## `cSearchPath() <cimport.html#cSearchPath,string>`_.
|
||||
runnableExamples:
|
||||
import paths, os
|
||||
import nimterop/paths, os
|
||||
static:
|
||||
cAddSearchDir testsIncludeDir()
|
||||
doAssert cSearchPath("test.h").existsFile
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ proc execAction(cmd: string): string =
|
|||
doAssert ret == 0, "Command failed: " & $ret & "\ncmd: " & ccmd & "\nresult:\n" & result
|
||||
|
||||
proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath() & $DirSep,
|
||||
defines: openArray[string] = @[]) =
|
||||
defines: openArray[string] = @[], compilerArgs = "") =
|
||||
## Generate docs for all specified nim `files` to the specified `path`
|
||||
##
|
||||
## `baseDir` is the project path by default and `files` and `path` are relative
|
||||
|
|
@ -70,7 +70,7 @@ proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath
|
|||
defStr
|
||||
nim = getCurrentCompilerExe()
|
||||
for file in files:
|
||||
echo execAction(&"{nim} doc {defStr} -o:{path} --project --index:on {baseDir & file}")
|
||||
echo execAction(&"{nim} doc {defStr} {compilerArgs} -o:{path} --project --index:on {baseDir & file}")
|
||||
|
||||
echo execAction(&"{nim} buildIndex -o:{path}/theindex.html {path}")
|
||||
when declared(getNimRootDir):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import std/unittest
|
||||
import os
|
||||
import macros
|
||||
import nimterop/cimport
|
||||
import nimterop/paths
|
||||
|
||||
|
|
@ -10,7 +12,7 @@ cDefine("FORCE")
|
|||
cIncludeDir testsIncludeDir()
|
||||
cCompile cSearchPath("test.c")
|
||||
|
||||
cPluginPath("tests/tnimterop_c_plugin.nim")
|
||||
cPluginPath(getProjectPath() / "tnimterop_c_plugin.nim")
|
||||
|
||||
cOverride:
|
||||
type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue