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

Function TestMain

script/ghmock/run_test.go:30–38  ·  view source on GitHub ↗

TestMain lets the test binary stand in for gh. runBinary starts gh with an environment built from scratch, so a small wrapper script sets GHMOCK_FAKE_GH before running this binary.

(m *testing.M)

Source from the content-addressed store, hash-verified

28// environment built from scratch, so a small wrapper script sets
29// GHMOCK_FAKE_GH before running this binary.
30func TestMain(m *testing.M) {
31 if len(os.Args) > 1 && os.Args[1] == "_git-ssh" {
32 os.Exit(runMain(os.Args[1:], os.Stdout, os.Stderr))
33 }
34 if os.Getenv("GHMOCK_FAKE_GH") == "1" {
35 os.Exit(fakeGH(os.Args[1:]))
36 }
37 os.Exit(runTests(m))
38}
39
40// runTests keeps tests away from the network and the real cache folder. Tests
41// that need schemas call useTestSchemas.

Callers

nothing calls this directly

Calls 3

runMainFunction · 0.85
fakeGHFunction · 0.85
runTestsFunction · 0.85

Tested by

no test coverage detected