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

Function TestCommitsHelperProcess

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected