TestParseDiffText_PureRename covers a 100% similarity rename, which carries no hunks and no ---/+++ lines at all.
(t *testing.T)
| 48 | // TestParseDiffText_PureRename covers a 100% similarity rename, which carries |
| 49 | // no hunks and no ---/+++ lines at all. |
| 50 | func TestParseDiffText_PureRename(t *testing.T) { |
| 51 | diffText := `diff --git a/old.go b/new.go |
| 52 | similarity index 100% |
| 53 | rename from old.go |
| 54 | rename to new.go |
| 55 | ` |
| 56 | diffs, err := ParseDiffText(context.Background(), diffText, t.TempDir(), "", nil) |
| 57 | if err != nil { |
| 58 | t.Fatalf("ParseDiffText: %v", err) |
| 59 | } |
| 60 | if len(diffs) != 1 { |
| 61 | t.Fatalf("expected 1 diff, got %d", len(diffs)) |
| 62 | } |
| 63 | d := diffs[0] |
| 64 | if !d.IsRenamed || d.OldPath != "old.go" || d.NewPath != "new.go" { |
| 65 | t.Errorf("got IsRenamed=%v OldPath=%q NewPath=%q, want true/old.go/new.go", |
| 66 | d.IsRenamed, d.OldPath, d.NewPath) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // TestParseDiffText_DeletedFile guards the /dev/null detection: git emits |
| 71 | // "+++ /dev/null" WITHOUT the b/ prefix, which the old regexes required, so |
nothing calls this directly
no test coverage detected