testament: individual tests with more than a subdir in their path (#9971)

e.g.: PATH="./bin:$PATH" ./koch tests r stdlib/nre/captures.nim
This commit is contained in:
Andreas Rumpf 2018-12-16 09:12:16 +01:00 • committed by GitHub
commit 442e12ebb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -565,10 +565,12 @@ proc main() =
p.next p.next
processCategory(r, cat, p.cmdLineRest.string, testsDir, runJoinableTests = false) processCategory(r, cat, p.cmdLineRest.string, testsDir, runJoinableTests = false)
of "r", "run": of "r", "run":
let (dir, file) = splitPath(p.key.string) # at least one directory is required in the path, to use as a category name
let (_, subdir) = splitPath(dir) let pathParts = split(p.key.string, {DirSep, AltSep})
var cat = Category(subdir) # "stdlib/nre/captures.nim" -> "stdlib" + "nre/captures.nim"
processSingleTest(r, cat, p.cmdLineRest.string, file) let cat = Category(pathParts[0])
let subPath = joinPath(pathParts[1..^1])
processSingleTest(r, cat, p.cmdLineRest.string, subPath)
of "html": of "html":
generateHtml(resultsFile, optFailing) generateHtml(resultsFile, optFailing)
else: else: