* fixes #11953; jsondoc creates no files unless the htmldocs dir is created * target * fixes runner
This commit is contained in:
parent
1b61e71bb8
commit
d8d86e07c3
2 changed files with 18 additions and 0 deletions
|
|
@ -1617,6 +1617,8 @@ proc writeOutputJson*(d: PDoc, useWarning = false) =
|
||||||
if optStdout in d.conf.globalOptions:
|
if optStdout in d.conf.globalOptions:
|
||||||
write(stdout, $content)
|
write(stdout, $content)
|
||||||
else:
|
else:
|
||||||
|
let dir = d.destFile.splitFile.dir
|
||||||
|
createDir(dir)
|
||||||
var f: File
|
var f: File
|
||||||
if open(f, d.destFile, fmWrite):
|
if open(f, d.destFile, fmWrite):
|
||||||
write(f, $content)
|
write(f, $content)
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,22 @@ sub/mmain.idx""", context
|
||||||
doAssert doSomething["col"].getInt == 0
|
doAssert doSomething["col"].getInt == 0
|
||||||
doAssert doSomething["code"].getStr == "proc doSomething(x, y: int): int {.raises: [], tags: [], forbids: [].}"
|
doAssert doSomething["code"].getStr == "proc doSomething(x, y: int): int {.raises: [], tags: [], forbids: [].}"
|
||||||
|
|
||||||
|
block: # nim jsondoc # bug #11953
|
||||||
|
let file = testsDir / "misc/mjsondoc.nim"
|
||||||
|
let destDir = testsDir / "misc/htmldocs"
|
||||||
|
removeDir(destDir)
|
||||||
|
defer: removeDir(destDir)
|
||||||
|
let (msg, exitCode) = execCmdEx(fmt"{nim} jsondoc {file}")
|
||||||
|
doAssert exitCode == 0, msg
|
||||||
|
|
||||||
|
let data = parseJson(readFile(destDir / "mjsondoc.json"))["entries"]
|
||||||
|
doAssert data.len == 4
|
||||||
|
let doSomething = data[0]
|
||||||
|
doAssert doSomething["name"].getStr == "doSomething"
|
||||||
|
doAssert doSomething["type"].getStr == "skProc"
|
||||||
|
doAssert doSomething["line"].getInt == 1
|
||||||
|
doAssert doSomething["col"].getInt == 0
|
||||||
|
doAssert doSomething["code"].getStr == "proc doSomething(x, y: int): int {.raises: [], tags: [], forbids: [].}"
|
||||||
|
|
||||||
block: # further issues with `--backend`
|
block: # further issues with `--backend`
|
||||||
let file = testsDir / "misc/mbackend.nim"
|
let file = testsDir / "misc/mbackend.nim"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue