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

Function createCommandContext

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

Source from the content-addressed store, hash-verified

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