summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-12-16 09:12:16 +0100
committerGitHub <noreply@github.com>2018-12-16 09:12:16 +0100
commit442e12ebb140dd331b5200296223694cea704148 (patch)
tree6310b7a8d54e8b6ea84e7f41613701ff283b4290
parent303ef57b1592eaf2131e15143e79187c01096dca (diff)
parenta96928968e751be8066828b6c9b2ce8a993660c5 (diff)
downloadNim-442e12ebb140dd331b5200296223694cea704148.tar.gz
testament: individual tests with more than a subdir in their path (#9971)
e.g.: PATH="./bin:$PATH" ./koch tests r stdlib/nre/captures.nim
-rw-r--r--testament/tester.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/testament/tester.nim b/testament/tester.nim
index 48e9f1913..a056f36d2 100644
--- a/testament/tester.nim
+++ b/testament/tester.nim
@@ -565,10 +565,12 @@ proc main() =
     p.next
     processCategory(r, cat, p.cmdLineRest.string, testsDir, runJoinableTests = false)
   of "r", "run":
-    let (dir, file) = splitPath(p.key.string)
-    let (_, subdir) = splitPath(dir)
-    var cat = Category(subdir)
-    processSingleTest(r, cat, p.cmdLineRest.string, file)
+    # at least one directory is required in the path, to use as a category name
+    let pathParts = split(p.key.string, {DirSep, AltSep})
+    # "stdlib/nre/captures.nim" -> "stdlib" + "nre/captures.nim"
+    let cat = Category(pathParts[0])
+    let subPath = joinPath(pathParts[1..^1])
+    processSingleTest(r, cat, p.cmdLineRest.string, subPath)
   of "html":
     generateHtml(resultsFile, optFailing)
   else: