(t *testing.T, testData stubbedCommitsCommandData)
| 690 | } |
| 691 | |
| 692 | func createCommitsCommandContext(t *testing.T, testData stubbedCommitsCommandData) (*exec.Cmd, commandCtx) { |
| 693 | t.Helper() |
| 694 | |
| 695 | b, err := json.Marshal(testData) |
| 696 | require.NoError(t, err) |
| 697 | |
| 698 | cmd := exec.CommandContext(context.Background(), os.Args[0], "-test.run=TestCommitsHelperProcess", "--") |
| 699 | cmd.Env = []string{ |
| 700 | "GH_WANT_HELPER_PROCESS=1", |
| 701 | "GH_COMMITS_TEST_DATA=" + string(b), |
| 702 | } |
| 703 | return cmd, func(ctx context.Context, exe string, args ...string) *exec.Cmd { |
| 704 | cmd.Args = append(cmd.Args, exe) |
| 705 | cmd.Args = append(cmd.Args, args...) |
| 706 | return cmd |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | func TestClientLastCommit(t *testing.T) { |
| 711 | client := Client{ |
no test coverage detected