Skip to content

Commit d2f69c4

Browse files
committed
[testament] compile/run compiler/**
1 parent 2039dad commit d2f69c4

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

testament/categories.nim

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,23 +401,22 @@ proc compileExample(r: var TResults, pattern, options: string, cat: Category) =
401401
test.spec.action = actionCompile
402402
testSpec r, test
403403

404-
proc testStdlib(r: var TResults, pattern, options: string, cat: Category) =
404+
type IsValidProc = proc(file: string): bool
405+
406+
proc testLibGeneric(r: var TResults, pattern, options: string, cat: Category, isValid: IsValidProc) =
405407
var files: seq[string]
406408

407-
proc isValid(file: string): bool =
409+
proc isValidGeneric(file: string): bool =
408410
for dir in parentDirs(file, inclusive = false):
409411
if dir.lastPathPart in ["includes", "nimcache"]:
410412
# eg: lib/pure/includes/osenv.nim gives: Error: This is an include file for os.nim!
411413
return false
412414
let name = extractFilename(file)
413415
if name.splitFile.ext != ".nim": return false
414-
for namei in disabledFiles:
415-
# because of `LockFreeHash.nim` which has case
416-
if namei.cmpPaths(name) == 0: return false
417416
return true
418417

419418
for testFile in os.walkDirRec(pattern):
420-
if isValid(testFile):
419+
if isValidGeneric(testFile) and isValid(testFile):
421420
files.add testFile
422421

423422
files.sort # reproducible order
@@ -436,6 +435,19 @@ proc testStdlib(r: var TResults, pattern, options: string, cat: Category) =
436435
testObj.spec.action = actionCompile
437436
testSpec r, testObj
438437

438+
proc testCompilerlib(r: var TResults, pattern, options: string, cat: Category) =
439+
proc isValid(file: string): bool = true
440+
testLibGeneric(r, pattern, options, cat, isValid)
441+
442+
proc testStdlib(r: var TResults, pattern, options: string, cat: Category) =
443+
proc isValid(file: string): bool =
444+
let name = extractFilename(file)
445+
for namei in disabledFiles:
446+
# because of `LockFreeHash.nim` which has case
447+
if namei.cmpPaths(name) == 0: return false
448+
return true
449+
testLibGeneric(r, pattern, options, cat, isValid)
450+
439451
# ----------------------------- nimble ----------------------------------------
440452
type
441453
PackageFilter = enum
@@ -688,6 +700,8 @@ proc processCategory(r: var TResults, cat: Category, options, testsDir: string,
688700
of "lib":
689701
testStdlib(r, "lib/pure/", options, cat)
690702
testStdlib(r, "lib/packages/docutils/", options, cat)
703+
of "compilerlib":
704+
testCompilerlib(r, "compiler/", options, cat)
691705
of "examples":
692706
compileExample(r, "examples/*.nim", options, cat)
693707
compileExample(r, "examples/gtk/*.nim", options, cat)

testament/tester.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
236236
# test.name is easier to find than test.name.extractFilename
237237
# A bit hacky but simple and works with tests/testament/tshouldfail.nim
238238
var name = test.name.replace(DirSep, '/')
239-
name.add " " & $target & test.options
239+
name.add " " & $target & " " & $test.spec.action & " " & test.options
240240

241241
let duration = epochTime() - test.startTime
242242
let durationStr = duration.formatFloat(ffDecimal, precision = 8).align(11)

0 commit comments

Comments
 (0)