add test for --eval; fix a minor bug (#16224)
This commit is contained in:
parent
9fa5826d62
commit
84f2ad3068
2 changed files with 7 additions and 0 deletions
|
|
@ -450,6 +450,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
conf.projectIsCmd = true
|
conf.projectIsCmd = true
|
||||||
conf.cmdInput = arg # can be empty (a nim file with empty content is valid too)
|
conf.cmdInput = arg # can be empty (a nim file with empty content is valid too)
|
||||||
if conf.cmd == cmdNone:
|
if conf.cmd == cmdNone:
|
||||||
|
conf.command = "e"
|
||||||
conf.setCmd cmdNimscript # better than `cmdCrun` as a default
|
conf.setCmd cmdNimscript # better than `cmdCrun` as a default
|
||||||
conf.implicitCmd = true
|
conf.implicitCmd = true
|
||||||
of "path", "p":
|
of "path", "p":
|
||||||
|
|
|
||||||
|
|
@ -216,3 +216,9 @@ mmain.html
|
||||||
let file = testsDir / "misc/mimportc.nim"
|
let file = testsDir / "misc/mimportc.nim"
|
||||||
let cmd = fmt"{nim} r -b:cpp --hints:off --nimcache:{nimcache} --warningAsError:ProveInit {file}"
|
let cmd = fmt"{nim} r -b:cpp --hints:off --nimcache:{nimcache} --warningAsError:ProveInit {file}"
|
||||||
check execCmdEx(cmd) == ("witness\n", 0)
|
check execCmdEx(cmd) == ("witness\n", 0)
|
||||||
|
|
||||||
|
block: # nim --eval
|
||||||
|
let opt = "--hints:off"
|
||||||
|
check fmt"""{nim} {opt} --eval:"echo defined(nimscript)"""".execCmdEx == ("true\n", 0)
|
||||||
|
check fmt"""{nim} r {opt} --eval:"echo defined(c)"""".execCmdEx == ("true\n", 0)
|
||||||
|
check fmt"""{nim} r -b:js {opt} --eval:"echo defined(js)"""".execCmdEx == ("true\n", 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue