allow testament/tester to run single file

This commit is contained in:
Aman Gupta 2015-09-30 12:09:58 -07:00
commit 435fbbc943
2 changed files with 8 additions and 2 deletions

View file

@ -339,7 +339,7 @@ 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) = proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") =
case cat.string.normalize case cat.string.normalize
of "rodfiles": of "rodfiles":
discard # Disabled for now discard # Disabled for now
@ -376,5 +376,5 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
of "nimble-all": of "nimble-all":
testNimblePackages(r, cat, pfAll) testNimblePackages(r, cat, pfAll)
else: else:
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"): for name in os.walkFiles("tests" & DirSep &.? cat.string / fileGlob):
testSpec r, makeTest(name, options, cat) testSpec r, makeTest(name, options, cat)

View file

@ -23,6 +23,7 @@ const
Command: Command:
all run all tests all run all tests
c|category <category> run all the tests of a certain category c|category <category> run all the tests of a certain category
r|run <test> run single test file
html [commit] generate $1 from the database; uses the latest html [commit] generate $1 from the database; uses the latest
commit or a specific one (use -1 for the commit commit or a specific one (use -1 for the commit
before latest etc) before latest etc)
@ -376,6 +377,11 @@ proc main() =
var cat = Category(p.key) var cat = Category(p.key)
p.next p.next
processCategory(r, cat, p.cmdLineRest.string) processCategory(r, cat, p.cmdLineRest.string)
of "r", "run":
let (dir, file) = splitPath(p.key.string)
let (_, subdir) = splitPath(dir)
var cat = Category(subdir)
processCategory(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)