(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func initRepo(t *testing.T) string { |
| 15 | t.Helper() |
| 16 | dir := t.TempDir() |
| 17 | run := func(args ...string) { |
| 18 | cmd := exec.Command("git", args...) |
| 19 | cmd.Dir = dir |
| 20 | cmd.Env = append(os.Environ(), |
| 21 | "GIT_AUTHOR_NAME=test", |
| 22 | "GIT_AUTHOR_EMAIL=test@test.com", |
| 23 | "GIT_COMMITTER_NAME=test", |
| 24 | "GIT_COMMITTER_EMAIL=test@test.com", |
| 25 | ) |
| 26 | out, err := cmd.CombinedOutput() |
| 27 | if err != nil { |
| 28 | t.Fatalf("git %v: %v\n%s", args, err, out) |
| 29 | } |
| 30 | } |
| 31 | run("init") |
| 32 | run("config", "user.email", "test@test.com") |
| 33 | run("config", "user.name", "test") |
| 34 | if err := os.WriteFile(filepath.Join(dir, "hello.txt"), []byte("hello\n"), 0644); err != nil { |
| 35 | t.Fatal(err) |
| 36 | } |
| 37 | run("add", "hello.txt") |
| 38 | run("commit", "-m", "init") |
| 39 | return dir |
| 40 | } |
| 41 | |
| 42 | func TestRunner_New(t *testing.T) { |
| 43 | r := New(0) |
no test coverage detected