Add patch.LineStats func to get patch additions/deletions summary #949

Open
sosedoff wants to merge 2 commits from sosedoff/add-patch-stats into main
2 changed files with 4 additions and 4 deletions
Showing only changes of commit e24dc55e1b - Show all commits

View File

@ -37,7 +37,7 @@ func (patch *Patch) Free() error {
return nil return nil
} }
func (patch *Patch) Stats() (uint, uint, error) { func (patch *Patch) LineStats() (uint, uint, error) {
if patch.ptr == nil { if patch.ptr == nil {
return 0, 0, ErrInvalid return 0, 0, ErrInvalid
} }

View File

@ -36,12 +36,12 @@ func TestPatch(t *testing.T) {
t.Fatalf("patch was bad") t.Fatalf("patch was bad")
} }
numAdditions, numDeletions, err := patch.Stats() numAdditions, numDeletions, err := patch.LineStats()
checkFatal(t, err) checkFatal(t, err)
if numAdditions != 1 { if numAdditions != 1 {
t.Fatal("Incorrect number of additions in stats") t.Fatal("Incorrect number of additions in line stats")
} }
if numDeletions != 1 { if numDeletions != 1 {
t.Fatal("Incorrect number of deletions in stats") t.Fatal("Incorrect number of deletions in line stats")
} }
} }