helper: test non-existent helpers

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
2024-10-06 16:00:59 +09:00
parent ba76e2919b
commit 18d9ce733e
3 changed files with 30 additions and 7 deletions

View File

@@ -85,6 +85,11 @@ func InternalReplaceExecCommand(t *testing.T) {
// replace execCommand to have the resulting *exec.Cmd launch TestHelperChildStub
execCommand = func(name string, arg ...string) *exec.Cmd {
// pass through nonexistent path
if name == "/nonexistent" && len(arg) == 0 {
return exec.Command(name)
}
return exec.Command(os.Args[0], append([]string{"-test.run=TestHelperChildStub", "--", name}, arg...)...)
}
}