Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 04:36:11 +01:00

Fix "index out of range" runtime error in repo_list tests (#2376)

This commit is contained in:
Morlinest 2017-08-28 03:33:38 +02:00 committed by Lunny Xiao
parent ae08e6c5be
commit 0f2c98adcd

View file

@ -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{