MCPcopy
hub / github.com/cli/cli / createCommandContext

Function createCommandContext

git/client_test.go:2135–2148  ·  view source on GitHub ↗
(t *testing.T, exitStatus int, stdout, stderr string)

Source from the content-addressed store, hash-verified

2133}
2134
2135func 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
2150func createMockedCommandContext(t *testing.T, commands mockedCommands) commandCtx {
2151 marshaledCommands, err := json.Marshal(commands)

Callers 15

TestClientCurrentBranchFunction · 0.85
TestClientShowRefsFunction · 0.85
TestClientConfigFunction · 0.85
TestClientDeleteLocalTagFunction · 0.85
TestClientHasLocalBranchFunction · 0.85
TestClientCheckoutBranchFunction · 0.85
TestClientToplevelDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected