summaryrefslogtreecommitdiffstats
path: root/models/update_test.go
diff options
context:
space:
mode:
authorMorlinest <Morlinest@users.noreply.github.com>2017-08-28 11:17:45 +0200
committerLauris BH <lauris@nix.lv>2017-08-28 12:17:45 +0300
commit8e61823ec403b661359373f8f8b0c9a7c9ea368d (patch)
tree0ee6d56bf3f1c01348afa2a2f03dfbd6f72815de /models/update_test.go
parentced50e0ec13085504fa19c82f018a2eecb70ff68 (diff)
downloadgitea-8e61823ec403b661359373f8f8b0c9a7c9ea368d.tar.gz
gitea-8e61823ec403b661359373f8f8b0c9a7c9ea368d.zip
Fix tests code to prevent some runtime errors (#2381)
* Fix tests code to prevent some runtime errors * Reduce nesting
Diffstat (limited to 'models/update_test.go')
-rw-r--r--models/update_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/models/update_test.go b/models/update_test.go
index ae95a9641b..45451ee437 100644
--- a/models/update_test.go
+++ b/models/update_test.go
@@ -70,17 +70,17 @@ func TestListToPushCommits(t *testing.T) {
pushCommits := ListToPushCommits(l)
assert.Equal(t, 2, pushCommits.Len)
- assert.Equal(t, 2, len(pushCommits.Commits))
+ if assert.Len(t, pushCommits.Commits, 2) {
+ assert.Equal(t, "Message1", pushCommits.Commits[0].Message)
+ assert.Equal(t, hexString1, pushCommits.Commits[0].Sha1)
+ assert.Equal(t, "example@example.com", pushCommits.Commits[0].AuthorEmail)
+ assert.Equal(t, now, pushCommits.Commits[0].Timestamp)
- assert.Equal(t, "Message1", pushCommits.Commits[0].Message)
- assert.Equal(t, hexString1, pushCommits.Commits[0].Sha1)
- assert.Equal(t, "example@example.com", pushCommits.Commits[0].AuthorEmail)
- assert.Equal(t, now, pushCommits.Commits[0].Timestamp)
-
- assert.Equal(t, "Message2", pushCommits.Commits[1].Message)
- assert.Equal(t, hexString2, pushCommits.Commits[1].Sha1)
- assert.Equal(t, "example@example.com", pushCommits.Commits[1].AuthorEmail)
- assert.Equal(t, now, pushCommits.Commits[1].Timestamp)
+ assert.Equal(t, "Message2", pushCommits.Commits[1].Message)
+ assert.Equal(t, hexString2, pushCommits.Commits[1].Sha1)
+ assert.Equal(t, "example@example.com", pushCommits.Commits[1].AuthorEmail)
+ assert.Equal(t, now, pushCommits.Commits[1].Timestamp)
+ }
}
// TODO TestPushUpdate