Make --backend:cpp|js work for :test: code-blocks as well (#14306)
Continues9502e39b63Ref: -9502e39b63 (commitcomment-39087584)- https://github.com/nim-lang/Nim/pull/14278 Fixes https://github.com/nim-lang/Nim/issues/13129 .
This commit is contained in:
parent
76f7e95814
commit
86669ef5b4
2 changed files with 3 additions and 2 deletions
|
|
@ -216,7 +216,8 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
|
||||||
# Include the current file if we're parsing a nim file
|
# Include the current file if we're parsing a nim file
|
||||||
let importStmt = if d.isPureRst: "" else: "import \"$1\"\n" % [d.filename.replace("\\", "/")]
|
let importStmt = if d.isPureRst: "" else: "import \"$1\"\n" % [d.filename.replace("\\", "/")]
|
||||||
writeFile(outp, importStmt & content)
|
writeFile(outp, importStmt & content)
|
||||||
let c = if cmd.startsWith("nim "): os.getAppFilename() & cmd.substr(3)
|
let c = if cmd.startsWith("nim <backend> "): os.getAppFilename() & " " & $conf.backend & cmd.substr("nim <backend>".len)
|
||||||
|
elif cmd.startsWith("nim "): os.getAppFilename() & cmd.substr("nim".len)
|
||||||
else: cmd
|
else: cmd
|
||||||
let c2 = c % quoteShell(outp)
|
let c2 = c % quoteShell(outp)
|
||||||
rawMessage(conf, hintExecuting, c2)
|
rawMessage(conf, hintExecuting, c2)
|
||||||
|
|
|
||||||
|
|
@ -865,7 +865,7 @@ proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
|
||||||
of "test":
|
of "test":
|
||||||
params.testCmd = n.getFieldValue.strip
|
params.testCmd = n.getFieldValue.strip
|
||||||
if params.testCmd.len == 0:
|
if params.testCmd.len == 0:
|
||||||
params.testCmd = "nim c -r $1"
|
params.testCmd = "nim <backend> -r $1" # The nim backend is auto-set in docgen.nim
|
||||||
else:
|
else:
|
||||||
params.testCmd = unescape(params.testCmd)
|
params.testCmd = unescape(params.testCmd)
|
||||||
of "status", "exitcode":
|
of "status", "exitcode":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue