Merge pull request #4800 from Wh1teDuke/FixTesterRunOpt

[Tester] allow running single tests with 'run' option
This commit is contained in:
Andreas Rumpf 2016-10-24 19:02:34 +02:00 • committed by GitHub
commit 56181da204
2 changed files with 9 additions and 3 deletions

View file

@ -383,7 +383,13 @@ proc `&?.`(a, b: string): string =
# candidate for the stdlib? # candidate for the stdlib?
result = if a.endswith(b): a else: a & b result = if a.endswith(b): a else: a & b
proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") = proc processSingleTest(r: var TResults, cat: Category, options, test: string) =
let test = "tests" & DirSep &.? cat.string / test
if existsFile(test): testSpec r, makeTest(test, options, cat)
else: echo "[Warning] - ", test, " test does not exist"
proc processCategory(r: var TResults, cat: Category, options: string) =
case cat.string.normalize case cat.string.normalize
of "rodfiles": of "rodfiles":
when false: compileRodFiles(r, cat, options) when false: compileRodFiles(r, cat, options)
@ -424,5 +430,5 @@ proc processCategory(r: var TResults, cat: Category, options: string, fileGlob:
# We can't test it because it depends on a third party. # We can't test it because it depends on a third party.
discard # TODO: Move untestable tests to someplace else, i.e. nimble repo. discard # TODO: Move untestable tests to someplace else, i.e. nimble repo.
else: else:
for name in os.walkFiles("tests" & DirSep &.? cat.string / fileGlob): for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
testSpec r, makeTest(name, options, cat) testSpec r, makeTest(name, options, cat)

View file

@ -445,7 +445,7 @@ proc main() =
let (dir, file) = splitPath(p.key.string) let (dir, file) = splitPath(p.key.string)
let (_, subdir) = splitPath(dir) let (_, subdir) = splitPath(dir)
var cat = Category(subdir) var cat = Category(subdir)
processCategory(r, cat, p.cmdLineRest.string, file) processSingleTest(r, cat, p.cmdLineRest.string, file)
of "html": of "html":
var commit = 0 var commit = 0
discard parseInt(p.cmdLineRest.string, commit) discard parseInt(p.cmdLineRest.string, commit)