Skip to content

Commit

Permalink
Ability to filter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
delasy committed Feb 11, 2025
1 parent f4b9315 commit 56dbbcd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ main {
"Exclude paths separated by comma.",
)

.option(
"filter",
"Filter underlying tests by name.",
)

.option(
"help",
"Print help information.",
Expand Down Expand Up @@ -230,6 +235,7 @@ main {
? Config.offlineCompilerPath()
: ""
mut excludePaths := [".git", ".svn", "thumbs.db", ".DS_Store"]
mut filter: str?
mut outputPath := ""
mut platform := ""
mut runArgs := ""
Expand Down Expand Up @@ -268,6 +274,8 @@ main {
} elif arg.option == "exclude" {
paths := mapStr(arg.value.split(","), (it: str, idx: int) -> str { return it.trim() })
excludePaths.merge(paths)
} elif arg.option == "filter" {
filter = arg.value
} elif arg.option == "output" {
outputPath = fs_isAbsoluteSync(arg.value) ? arg.value : cwd + path_SEP + arg.value
} elif arg.option == "platform" {
Expand Down Expand Up @@ -363,7 +371,13 @@ main {
qs += "&m=__the__main__"
command(compiler, "compile", tester.outputDir, tester.outputPath, platform, arch, qs)

stdout := process_runSync(tester.outputPath)
mut cmd := tester.outputPath

if filter != nil {
cmd += " --filter=\"" + filter + "\""
}

stdout := process_runSync(cmd)
print(stdout.str(), terminator: "")

tester.deinit()
Expand Down

0 comments on commit 56dbbcd

Please sign in to comment.