diff options
Diffstat (limited to 'testament/testament.nim')
-rw-r--r-- | testament/testament.nim | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/testament/testament.nim b/testament/testament.nim index 9d3e9e702..c6ceed224 100644 --- a/testament/testament.nim +++ b/testament/testament.nim @@ -54,6 +54,13 @@ On Azure Pipelines, testament will also publish test results via Azure Pipelines provided that System.AccessToken is made available via the environment variable SYSTEM_ACCESSTOKEN. """ % resultsFile +proc isNimRepoTests(): bool = + # this logic could either be specific to cwd, or to some file derived from + # the input file, eg testament r /pathto/tests/foo/tmain.nim; we choose + # the former since it's simpler and also works with `testament all`. + let file = "testament"/"testament.nim.cfg" + result = file.fileExists + type Category = distinct string TResults = object @@ -86,6 +93,11 @@ var targetsSet = false proc isSuccess(input: string): bool = # not clear how to do the equivalent of pkg/regex's: re"FOO(.*?)BAR" in pegs + # note: this doesn't handle colors, eg: `\e[1m\e[0m\e[32mHint:`; while we + # could handle colors, there would be other issues such as handling other flags + # that may appear in user config (eg: `--listFullPaths`). + # Passing `XDG_CONFIG_HOME= testament args...` can be used to ignore user config + # stored in XDG_CONFIG_HOME, refs https://wiki.archlinux.org/index.php/XDG_Base_Directory input.startsWith("Hint: ") and input.endsWith("[SuccessX]") proc getFileDir(filename: string): string = @@ -744,7 +756,8 @@ proc main() = let cat = dir[testsDir.len .. ^1] if kind == pcDir and cat notin ["testdata", "nimcache"]: cats.add cat - cats.add AdditionalCategories + if isNimRepoTests(): + cats.add AdditionalCategories if useMegatest: cats.add MegaTestCat var cmds: seq[string] |