Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-01 14:26:10 +01:00

Merge pull request 'test(dump): don't depend on directory listing order' (#4161) from emilylange/fix-dump-go-test into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4161
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-06-17 18:53:07 +00:00
commit bd23b8c75f

View file

@ -50,7 +50,7 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, nil, false) err = addRecursiveExclude(archiver, "", dir, nil, false)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 1) assert.Len(t, archiver.addedFiles, 1)
assert.EqualValues(t, "example", archiver.addedFiles[0]) assert.Contains(t, archiver.addedFiles, "example")
}) })
t.Run("With exclude", func(t *testing.T) { t.Run("With exclude", func(t *testing.T) {
@ -77,11 +77,11 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, nil, false) err = addRecursiveExclude(archiver, "", dir, nil, false)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 5) assert.Len(t, archiver.addedFiles, 5)
assert.EqualValues(t, "deep", archiver.addedFiles[0]) assert.Contains(t, archiver.addedFiles, "deep")
assert.EqualValues(t, "deep/nested", archiver.addedFiles[1]) assert.Contains(t, archiver.addedFiles, "deep/nested")
assert.EqualValues(t, "deep/nested/folder", archiver.addedFiles[2]) assert.Contains(t, archiver.addedFiles, "deep/nested/folder")
assert.EqualValues(t, "deep/nested/folder/example", archiver.addedFiles[3]) assert.Contains(t, archiver.addedFiles, "deep/nested/folder/example")
assert.EqualValues(t, "deep/nested/folder/another-file", archiver.addedFiles[4]) assert.Contains(t, archiver.addedFiles, "deep/nested/folder/another-file")
}) })
t.Run("Exclude first directory", func(t *testing.T) { t.Run("Exclude first directory", func(t *testing.T) {
@ -98,8 +98,8 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, []string{dir + "/deep/nested/folder"}, false) err = addRecursiveExclude(archiver, "", dir, []string{dir + "/deep/nested/folder"}, false)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 2) assert.Len(t, archiver.addedFiles, 2)
assert.EqualValues(t, "deep", archiver.addedFiles[0]) assert.Contains(t, archiver.addedFiles, "deep")
assert.EqualValues(t, "deep/nested", archiver.addedFiles[1]) assert.Contains(t, archiver.addedFiles, "deep/nested")
}) })
t.Run("Exclude file", func(t *testing.T) { t.Run("Exclude file", func(t *testing.T) {
@ -108,10 +108,10 @@ func TestAddRecursiveExclude(t *testing.T) {
err = addRecursiveExclude(archiver, "", dir, []string{dir + "/deep/nested/folder/example"}, false) err = addRecursiveExclude(archiver, "", dir, []string{dir + "/deep/nested/folder/example"}, false)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, archiver.addedFiles, 4) assert.Len(t, archiver.addedFiles, 4)
assert.EqualValues(t, "deep", archiver.addedFiles[0]) assert.Contains(t, archiver.addedFiles, "deep")
assert.EqualValues(t, "deep/nested", archiver.addedFiles[1]) assert.Contains(t, archiver.addedFiles, "deep/nested")
assert.EqualValues(t, "deep/nested/folder", archiver.addedFiles[2]) assert.Contains(t, archiver.addedFiles, "deep/nested/folder")
assert.EqualValues(t, "deep/nested/folder/another-file", archiver.addedFiles[3]) assert.Contains(t, archiver.addedFiles, "deep/nested/folder/another-file")
}) })
}) })
} }