MCPcopy Index your code
hub / github.com/cli/cli / TestCommitsHelperProcess

Function TestCommitsHelperProcess

git/client_test.go:665–690  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

663}
664
665func TestCommitsHelperProcess(t *testing.T) {
666 if os.Getenv("GH_WANT_HELPER_PROCESS") != "1" {
667 return
668 }
669
670 var td stubbedCommitsCommandData
671 _ = json.Unmarshal([]byte(os.Getenv("GH_COMMITS_TEST_DATA")), &td)
672
673 if td.ErrMsg != "" {
674 fmt.Fprint(os.Stderr, td.ErrMsg)
675 } else {
676 var sb strings.Builder
677 for _, commit := range td.Commits {
678 sb.WriteString(commit.Sha)
679 sb.WriteString("\u0000")
680 sb.WriteString(commit.Title)
681 sb.WriteString("\u0000")
682 sb.WriteString(commit.Body)
683 sb.WriteString("\u0000")
684 sb.WriteString("\n")
685 }
686 fmt.Fprint(os.Stdout, sb.String())
687 }
688
689 os.Exit(td.ExitStatus)
690}
691
692func createCommitsCommandContext(t *testing.T, testData stubbedCommitsCommandData) (*exec.Cmd, commandCtx) {
693 t.Helper()

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected