summary refs log tree commit diff stats
path: root/tests/misc/trunner.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-08-04 14:49:51 +0800
committerGitHub <noreply@github.com>2022-08-04 08:49:51 +0200
commit2aeb0d516b5e4cde1abb68a0c0d5393cf8c65915 (patch)
treea79857194297aa20629d8b89e1a5744f5c82af9c /tests/misc/trunner.nim
parent7af484da947abc5dfc1e941a45c1cde5ee995aae (diff)
downloadNim-2aeb0d516b5e4cde1abb68a0c0d5393cf8c65915.tar.gz
fixes #20132; fixes the broken jsondoc comand [backport] (#20135)
* fixes #20132; fixes the broken jsondoc comand

* add testcase
Diffstat (limited to 'tests/misc/trunner.nim')
-rw-r--r--tests/misc/trunner.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/misc/trunner.nim b/tests/misc/trunner.nim
index 5d12c38b6..67615cee9 100644
--- a/tests/misc/trunner.nim
+++ b/tests/misc/trunner.nim
@@ -216,6 +216,23 @@ sub/mmain.idx""", context
       let cmd = fmt"{nim} r --backend:{mode} --hints:off --nimcache:{nimcache} {file}"
       check execCmdEx(cmd) == ("ok3\n", 0)
 
+  block: # nim jsondoc # bug #20132
+    let file = testsDir / "misc/mjsondoc.nim"
+    let output = "nimcache_tjsondoc.json"
+    defer: removeFile(output)
+    let (msg, exitCode) = execCmdEx(fmt"{nim} jsondoc -o:{output} {file}")
+    doAssert exitCode == 0, msg
+
+    let data = parseJson(readFile(output))["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`
     let file = testsDir / "misc/mbackend.nim"
     var cmd = fmt"{nim} doc -b:cpp --hints:off --nimcache:{nimcache} {file}"