MCPcopy Create free account
hub / github.com/cli/cli / createCommandContext

Function createCommandContext

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

Source from the content-addressed store, hash-verified

2136}
2137
2138func createCommandContext(t *testing.T, exitStatus int, stdout, stderr string) (*exec.Cmd, commandCtx) {
2139 cmd := exec.CommandContext(context.Background(), os.Args[0], "-test.run=TestHelperProcess", "--")
2140 cmd.Env = []string{
2141 "GH_WANT_HELPER_PROCESS=1",
2142 fmt.Sprintf("GH_HELPER_PROCESS_STDOUT=%s", stdout),
2143 fmt.Sprintf("GH_HELPER_PROCESS_STDERR=%s", stderr),
2144 fmt.Sprintf("GH_HELPER_PROCESS_EXIT_STATUS=%v", exitStatus),
2145 }
2146 return cmd, func(ctx context.Context, exe string, args ...string) *exec.Cmd {
2147 cmd.Args = append(cmd.Args, exe)
2148 cmd.Args = append(cmd.Args, args...)
2149 return cmd
2150 }
2151}
2152
2153func createMockedCommandContext(t *testing.T, commands mockedCommands) commandCtx {
2154 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