Add patch.LineStats func to get patch additions/deletions summary #949
2
patch.go
2
patch.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue