aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'helper/export_test.go')
-rw-r--r--helper/export_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/helper/export_test.go b/helper/export_test.go
new file mode 100644
index 00000000..6bf18ce3
--- /dev/null
+++ b/helper/export_test.go
@@ -0,0 +1,18 @@
+package helper
+
+import (
+ "os"
+ "os/exec"
+ "testing"
+)
+
+// replace execCommand to have the resulting *exec.Cmd launch TestHelperChildStub
+func ReplaceExecCommand(t *testing.T) {
+ t.Cleanup(func() {
+ execCommand = exec.Command
+ })
+
+ execCommand = func(name string, arg ...string) *exec.Cmd {
+ return exec.Command(os.Args[0], append([]string{"-test.run=TestHelperChildStub", "--", name}, arg...)...)
+ }
+}