summaryrefslogtreecommitdiff
path: root/diff_test.go
diff options
context:
space:
mode:
authorHenning Perl <[email protected]>2014-12-28 23:07:33 +0100
committerCarlos Martín Nieto <[email protected]>2015-01-04 12:13:46 +0000
commit18aea4bfe89b83c5e2d6d55daa68efa6180655cc (patch)
tree6c050ae008188bd34c7f72a6d49d60e17d6003aa /diff_test.go
parentdae3004ca339f568db8991cf4d93d0ad6fbaffd1 (diff)
Add git_diff_get_stats()
This commit adds git_diff_get_stats() as well as functions to query the stats for insertions, deletions, and changed files.
Diffstat (limited to 'diff_test.go')
-rw-r--r--diff_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/diff_test.go b/diff_test.go
index 7c54f4e..fc6fed9 100644
--- a/diff_test.go
+++ b/diff_test.go
@@ -148,6 +148,20 @@ func TestDiffTreeToTree(t *testing.T) {
if want1, want2 := "x1/README", "y1/README"; !strings.Contains(patches[0], want1) || !strings.Contains(patches[0], want2) {
t.Errorf("Diff patch doesn't contain %q or %q\n\n%s", want1, want2, patches[0])
+
+ }
+
+ stats, err := diff.Stats()
+ checkFatal(t, err)
+
+ if stats.Insertions() != 1 {
+ t.Fatal("Incorrect number of insertions in diff")
+ }
+ if stats.Deletions() != 1 {
+ t.Fatal("Incorrect number of deletions in diff")
+ }
+ if stats.FilesChanged() != 1 {
+ t.Fatal("Incorrect number of changed files in diff")
}
errTest := errors.New("test error")