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

Function TestHelperProcess

pkg/cmd/extension/manager_test.go:27–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestHelperProcess(t *testing.T) {
28 if os.Getenv("GH_WANT_HELPER_PROCESS") != "1" {
29 return
30 }
31 if err := func(args []string) error {
32 // Dispatch tests use this marker argument to inspect the environment gh handed to
33 // the extension, rather than echoing the arguments back.
34 if len(args) > 0 && args[len(args)-1] == "print-env" {
35 fmt.Fprintf(os.Stdout, "GH_EXTENSION=%s\n", os.Getenv("GH_EXTENSION"))
36 fmt.Fprintf(os.Stdout, "GH_HELPER_INHERITED=%s\n", os.Getenv("GH_HELPER_INHERITED"))
37 return nil
38 }
39 fmt.Fprintf(os.Stdout, "%v\n", args)
40 return nil
41 }(os.Args[3:]); err != nil {
42 fmt.Fprintln(os.Stderr, err)
43 os.Exit(1)
44 }
45 os.Exit(0)
46}
47
48func newTestManager(dataDir, updateDir string, client *http.Client, gitClient gitClient, ios *iostreams.IOStreams, extraEnv ...string) *Manager {
49 return &Manager{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected