summaryrefslogtreecommitdiffstats
path: root/models/pull_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/pull_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/pull_test.go')
-rw-r--r--models/pull_test.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/models/pull_test.go b/models/pull_test.go
index 86c71f5658..c8eb033aa5 100644
--- a/models/pull_test.go
+++ b/models/pull_test.go
@@ -65,9 +65,10 @@ func TestPullRequestsNewest(t *testing.T) {
})
assert.NoError(t, err)
assert.Equal(t, int64(2), count)
- assert.Len(t, prs, 2)
- assert.Equal(t, int64(2), prs[0].ID)
- assert.Equal(t, int64(1), prs[1].ID)
+ if assert.Len(t, prs, 2) {
+ assert.Equal(t, int64(2), prs[0].ID)
+ assert.Equal(t, int64(1), prs[1].ID)
+ }
}
func TestPullRequestsOldest(t *testing.T) {
@@ -80,9 +81,10 @@ func TestPullRequestsOldest(t *testing.T) {
})
assert.NoError(t, err)
assert.Equal(t, int64(2), count)
- assert.Len(t, prs, 2)
- assert.Equal(t, int64(1), prs[0].ID)
- assert.Equal(t, int64(2), prs[1].ID)
+ if assert.Len(t, prs, 2) {
+ assert.Equal(t, int64(1), prs[0].ID)
+ assert.Equal(t, int64(2), prs[1].ID)
+ }
}
func TestGetUnmergedPullRequest(t *testing.T) {