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)
| 28 | // environment built from scratch, so a small wrapper script sets |
| 29 | // GHMOCK_FAKE_GH before running this binary. |
| 30 | func 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. |