fix #16256: nimout: <empty> should give error (vacuously true); improve a few tests (#18089)

* fix #16256: nimout: <empty> should give error (vacuously true); improve some tests

* renamed:    tests/stdlib/t9710.nim -> tests/misc/t9710.nim

* improve tests

* fix non-DRY tests

* improve $nim_prs_D/tests/stdlib/t9091.nim

* renamed:    tests/stdlib/t9091.nim -> tests/misc/t9091.nim

* fixup

* address comment: doAssert => result.parseErrors
This commit is contained in:
Timothee Cour 2021-05-31 04:39:19 -07:00 • committed by GitHub
commit a36efb59b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 106 deletions

View file

@ -253,6 +253,7 @@ proc parseSpec*(filename: string): TSpec =
var p: CfgParser
open(p, ss, filename, 1)
var flags: HashSet[string]
var nimoutFound = false
while true:
var e = next(p)
case e.kind
@ -309,6 +310,7 @@ proc parseSpec*(filename: string): TSpec =
result.action = actionReject
of "nimout":
result.nimout = e.value
nimoutFound = true
of "nimoutfull":
result.nimoutFull = parseCfgBool(e.value)
of "batchable":
@ -401,6 +403,9 @@ proc parseSpec*(filename: string): TSpec =
if skips.anyIt(it in result.file):
result.err = reDisabled
if nimoutFound and result.nimout.len == 0 and not result.nimoutFull:
result.parseErrors.addLine "empty `nimout` is vacuously true, use `nimoutFull:true` if intentional"
result.inCurrentBatch = isCurrentBatch(testamentData0, filename) or result.unbatchable
if not result.inCurrentBatch:
result.err = reDisabled