Browse Source

Fix inverted logic in TestRepositoriesService_CompareCommits.

Previously, the test would pass if got and want were different, and
fail if they were equal.

Closes #491.

Change-Id: Ie9b0059595ef85777613578b06c98c10104f4e6a
Dmitri Shuralyov 9 years ago
committed by Glenn Lewis
parent
commit
aacf907cae
1 changed files with 26 additions and 8 deletions
  1. +26
    -8
      github/repos_commits_test.go

+ 26
- 8
github/repos_commits_test.go View File

@ -180,7 +180,7 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
"message": "m",
"tree": { "sha": "t" }
},
"author": { "login": "n" },
"author": { "login": "l" },
"committer": { "login": "l" },
"parents": [ { "sha": "s" } ]
},
@ -207,21 +207,39 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
}
want := &CommitsComparison{
Status: String("s"),
AheadBy: Int(1),
BehindBy: Int(2),
TotalCommits: Int(1),
BaseCommit: &RepositoryCommit{
SHA: String("s"),
Commit: &Commit{
Author: &CommitAuthor{Name: String("n")},
Author: &CommitAuthor{Name: String("n")},
Committer: &CommitAuthor{Name: String("n")},
Message: String("m"),
Tree: &Tree{SHA: String("t")},
},
Author: &User{Login: String("l")},
Committer: &User{Login: String("l")},
Message: String("m"),
Parents: []Commit{
{
SHA: String("s"),
},
},
},
Status: String("s"),
AheadBy: Int(1),
BehindBy: Int(2),
TotalCommits: Int(1),
Commits: []RepositoryCommit{
{
SHA: String("s"),
Commit: &Commit{
Author: &CommitAuthor{Name: String("n")},
},
Author: &User{Login: String("l")},
Committer: &User{Login: String("l")},
Parents: []Commit{
{
SHA: String("s"),
},
},
},
},
Files: []CommitFile{
@ -231,7 +249,7 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
},
}
if reflect.DeepEqual(got, want) {
if !reflect.DeepEqual(got, want) {
t.Errorf("Repositories.CompareCommits returned \n%+v, want \n%+v", got, want)
}
}

Loading…
Cancel
Save