mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-30 11:13:57 +00:00
IC: bugfixes (WIP) (#16836)
* minor improvements * IC: added the required logic for compilerProcs * LazySym ftw * we need this testing logic * reimplement the old way we use for module package creation * fixes a regression; don't pick module names if you can avoid it
This commit is contained in:
@@ -499,6 +499,49 @@ proc testNimblePackages(r: var TResults; cat: Category; packageFilter: string, p
|
||||
finally:
|
||||
if errors == 0: removeDir(packagesDir)
|
||||
|
||||
# ---------------- IC tests ---------------------------------------------
|
||||
|
||||
proc icTests(r: var TResults; testsDir: string, cat: Category, options: string) =
|
||||
const
|
||||
tooltests = ["compiler/nim.nim", "tools/nimgrep.nim"]
|
||||
writeOnly = " --incremental:writeonly "
|
||||
readOnly = " --incremental:readonly "
|
||||
incrementalOn = " --incremental:on "
|
||||
|
||||
template test(x: untyped) =
|
||||
testSpecWithNimcache(r, makeRawTest(file, x & options, cat), nimcache)
|
||||
|
||||
template editedTest(x: untyped) =
|
||||
var test = makeTest(file, x & options, cat)
|
||||
test.spec.targets = {getTestSpecTarget()}
|
||||
testSpecWithNimcache(r, test, nimcache)
|
||||
|
||||
const tempExt = "_temp.nim"
|
||||
for it in walkDirRec(testsDir / "ic"):
|
||||
if isTestFile(it) and not it.endsWith(tempExt):
|
||||
let nimcache = nimcacheDir(it, options, getTestSpecTarget())
|
||||
removeDir(nimcache)
|
||||
|
||||
let content = readFile(it)
|
||||
for fragment in content.split("#!EDIT!#"):
|
||||
let file = it.replace(".nim", tempExt)
|
||||
writeFile(file, fragment)
|
||||
let oldPassed = r.passed
|
||||
editedTest incrementalOn
|
||||
if r.passed != oldPassed+1: break
|
||||
|
||||
when false:
|
||||
for file in tooltests:
|
||||
let nimcache = nimcacheDir(file, options, getTestSpecTarget())
|
||||
removeDir(nimcache)
|
||||
|
||||
let oldPassed = r.passed
|
||||
test writeOnly
|
||||
|
||||
if r.passed == oldPassed+1:
|
||||
test readOnly
|
||||
if r.passed == oldPassed+2:
|
||||
test readOnly
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
@@ -665,6 +708,8 @@ proc processCategory(r: var TResults, cat: Category,
|
||||
testNimblePackages(r, cat, options, ppTwo)
|
||||
of "niminaction":
|
||||
testNimInAction(r, cat, options)
|
||||
of "ic":
|
||||
icTests(r, testsDir, cat, options)
|
||||
of "untestable":
|
||||
# We can't test it because it depends on a third party.
|
||||
discard # TODO: Move untestable tests to someplace else, i.e. nimble repo.
|
||||
|
||||
Reference in New Issue
Block a user