* fix #16526 run config.nims before foo.nim.cfg * add test
This commit is contained in:
parent
2eccef7ad6
commit
471aab86a0
7 changed files with 21 additions and 2 deletions
|
|
@ -281,6 +281,8 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
|
||||||
|
|
||||||
if optSkipProjConfigFile notin conf.globalOptions:
|
if optSkipProjConfigFile notin conf.globalOptions:
|
||||||
readConfigFile(pd / cfg)
|
readConfigFile(pd / cfg)
|
||||||
|
if cfg == DefaultConfig:
|
||||||
|
runNimScriptIfExists(pd / DefaultConfigNims)
|
||||||
|
|
||||||
if conf.projectName.len != 0:
|
if conf.projectName.len != 0:
|
||||||
# new project wide config file:
|
# new project wide config file:
|
||||||
|
|
@ -289,8 +291,6 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
|
||||||
projectConfig = changeFileExt(conf.projectFull, "nim.cfg")
|
projectConfig = changeFileExt(conf.projectFull, "nim.cfg")
|
||||||
readConfigFile(projectConfig)
|
readConfigFile(projectConfig)
|
||||||
|
|
||||||
if cfg == DefaultConfig:
|
|
||||||
runNimScriptIfExists(pd / DefaultConfigNims)
|
|
||||||
|
|
||||||
let scriptFile = conf.projectFull.changeFileExt("nims")
|
let scriptFile = conf.projectFull.changeFileExt("nims")
|
||||||
let scriptIsProj = scriptFile == conf.projectFull
|
let scriptIsProj = scriptFile == conf.projectFull
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,25 @@ sub/mmain.idx""", context
|
||||||
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: # config.nims, nim.cfg, hintConf, bug #16557
|
||||||
|
let cmd = fmt"{nim} r {defaultHintsOff} --hint:conf tests/newconfig/bar/mfoo.nim"
|
||||||
|
let (outp, exitCode) = execCmdEx(cmd, options = {poStdErrToStdOut})
|
||||||
|
doAssert exitCode == 0
|
||||||
|
let dir = getCurrentDir()
|
||||||
|
let files = """
|
||||||
|
config/nim.cfg
|
||||||
|
config/config.nims
|
||||||
|
tests/config.nims
|
||||||
|
tests/newconfig/bar/nim.cfg
|
||||||
|
tests/newconfig/bar/config.nims
|
||||||
|
tests/newconfig/bar/mfoo.nim.cfg
|
||||||
|
tests/newconfig/bar/mfoo.nims""".splitLines
|
||||||
|
var expected = ""
|
||||||
|
for a in files:
|
||||||
|
let b = dir / a
|
||||||
|
expected.add &"Hint: used config file '{b}' [Conf]\n"
|
||||||
|
doAssert outp == expected, outp & "\n" & expected
|
||||||
|
|
||||||
block: # nim --eval
|
block: # nim --eval
|
||||||
let opt = "--hints:off"
|
let opt = "--hints:off"
|
||||||
check fmt"""{nim} {opt} --eval:"echo defined(nimscript)"""".execCmdEx == ("true\n", 0)
|
check fmt"""{nim} {opt} --eval:"echo defined(nimscript)"""".execCmdEx == ("true\n", 0)
|
||||||
|
|
|
||||||
0
tests/newconfig/bar/config.nims
Normal file
0
tests/newconfig/bar/config.nims
Normal file
0
tests/newconfig/bar/mfoo.nim
Normal file
0
tests/newconfig/bar/mfoo.nim
Normal file
0
tests/newconfig/bar/mfoo.nim.cfg
Normal file
0
tests/newconfig/bar/mfoo.nim.cfg
Normal file
0
tests/newconfig/bar/mfoo.nims
Normal file
0
tests/newconfig/bar/mfoo.nims
Normal file
0
tests/newconfig/bar/nim.cfg
Normal file
0
tests/newconfig/bar/nim.cfg
Normal file
Loading…
Add table
Add a link
Reference in a new issue