Skip to content

Commit

Permalink
Make --backend:cpp|js work for :test: code-blocks as well (#14306)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi authored May 11, 2020
1 parent 76f7e95 commit 86669ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
# Include the current file if we're parsing a nim file
let importStmt = if d.isPureRst: "" else: "import \"$1\"\n" % [d.filename.replace("\\", "/")]
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
let c2 = c % quoteShell(outp)
rawMessage(conf, hintExecuting, c2)
Expand Down
2 changes: 1 addition & 1 deletion lib/packages/docutils/rstgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
of "test":
params.testCmd = n.getFieldValue.strip
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:
params.testCmd = unescape(params.testCmd)
of "status", "exitcode":
Expand Down

0 comments on commit 86669ef

Please sign in to comment.