mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
add test for --eval; fix a minor bug (#16224)
This commit is contained in:
@@ -450,6 +450,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||
conf.projectIsCmd = true
|
||||
conf.cmdInput = arg # can be empty (a nim file with empty content is valid too)
|
||||
if conf.cmd == cmdNone:
|
||||
conf.command = "e"
|
||||
conf.setCmd cmdNimscript # better than `cmdCrun` as a default
|
||||
conf.implicitCmd = true
|
||||
of "path", "p":
|
||||
|
||||
@@ -216,3 +216,9 @@ mmain.html
|
||||
let file = testsDir / "misc/mimportc.nim"
|
||||
let cmd = fmt"{nim} r -b:cpp --hints:off --nimcache:{nimcache} --warningAsError:ProveInit {file}"
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user