diff options
author | Morlinest <Morlinest@users.noreply.github.com> | 2017-08-28 03:33:38 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-08-28 09:33:38 +0800 |
commit | 0f2c98adcdfee02eda9f82a58f5c1aefe2a891a5 (patch) | |
tree | b8775394da5adcf5a6f1aec512a3ddd932d1d91b /models | |
parent | ae08e6c5bee513d00b87d7e1e3941cf3a0012eb1 (diff) | |
download | gitea-0f2c98adcdfee02eda9f82a58f5c1aefe2a891a5.tar.gz gitea-0f2c98adcdfee02eda9f82a58f5c1aefe2a891a5.zip |
Fix "index out of range" runtime error in repo_list tests (#2376)
Diffstat (limited to 'models')
-rw-r--r-- | models/repo_list_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/repo_list_test.go b/models/repo_list_test.go index 9c8a526a43..8ac0d80489 100644 --- a/models/repo_list_test.go +++ b/models/repo_list_test.go @@ -23,7 +23,9 @@ func TestSearchRepositoryByName(t *testing.T) { assert.NotNil(t, repos) assert.NoError(t, err) - assert.Equal(t, "test_repo_12", repos[0].Name) + if assert.Len(t, repos, 1) { + assert.Equal(t, "test_repo_12", repos[0].Name) + } assert.Equal(t, int64(1), count) repos, count, err = SearchRepositoryByName(&SearchRepoOptions{ @@ -48,7 +50,9 @@ func TestSearchRepositoryByName(t *testing.T) { assert.NotNil(t, repos) assert.NoError(t, err) - assert.Equal(t, "test_repo_13", repos[0].Name) + if assert.Len(t, repos, 1) { + assert.Equal(t, "test_repo_13", repos[0].Name) + } assert.Equal(t, int64(1), count) repos, count, err = SearchRepositoryByName(&SearchRepoOptions{ |