(t *testing.T, exitStatus int, stdout, stderr string)
| 2133 | } |
| 2134 | |
| 2135 | func createCommandContext(t *testing.T, exitStatus int, stdout, stderr string) (*exec.Cmd, commandCtx) { |
| 2136 | cmd := exec.CommandContext(context.Background(), os.Args[0], "-test.run=TestHelperProcess", "--") |
| 2137 | cmd.Env = []string{ |
| 2138 | "GH_WANT_HELPER_PROCESS=1", |
| 2139 | fmt.Sprintf("GH_HELPER_PROCESS_STDOUT=%s", stdout), |
| 2140 | fmt.Sprintf("GH_HELPER_PROCESS_STDERR=%s", stderr), |
| 2141 | fmt.Sprintf("GH_HELPER_PROCESS_EXIT_STATUS=%v", exitStatus), |
| 2142 | } |
| 2143 | return cmd, func(ctx context.Context, exe string, args ...string) *exec.Cmd { |
| 2144 | cmd.Args = append(cmd.Args, exe) |
| 2145 | cmd.Args = append(cmd.Args, args...) |
| 2146 | return cmd |
| 2147 | } |
| 2148 | } |
| 2149 | |
| 2150 | func createMockedCommandContext(t *testing.T, commands mockedCommands) commandCtx { |
| 2151 | marshaledCommands, err := json.Marshal(commands) |
no outgoing calls
no test coverage detected