mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-18 17:22:56 +02:00
Fix test
This commit is contained in:
parent
a125a58e81
commit
87ed579357
@ -427,6 +427,7 @@ func GetTreeInformation(ctx context.Context, repo *repo_model.Repository, treePa
|
||||
if lastDirEntry.IsRegular() {
|
||||
// path.Dir cannot correctly handle .xxx file
|
||||
dir, _ = path.Split(treePath)
|
||||
dir = strings.TrimRight(dir, "/")
|
||||
if dir == "" {
|
||||
lastDirEntry = rootEntry
|
||||
} else {
|
||||
|
@ -139,14 +139,15 @@ func Test_GetTreeInformation(t *testing.T) {
|
||||
treeList, err = GetTreeInformation(ctx2, ctx2.Repo.Repository, "", refName)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, treeList, 2)
|
||||
assert.EqualValues(t, "README.md", treeList[0].Name)
|
||||
assert.EqualValues(t, "README.md", treeList[0].Path)
|
||||
assert.True(t, treeList[0].IsFile)
|
||||
|
||||
assert.EqualValues(t, "doc", treeList[0].Name)
|
||||
assert.EqualValues(t, "doc", treeList[0].Path)
|
||||
assert.False(t, treeList[0].IsFile)
|
||||
assert.Empty(t, treeList[0].Children)
|
||||
|
||||
assert.EqualValues(t, "doc", treeList[1].Name)
|
||||
assert.EqualValues(t, "doc", treeList[1].Path)
|
||||
assert.False(t, treeList[1].IsFile)
|
||||
assert.EqualValues(t, "README.md", treeList[1].Name)
|
||||
assert.EqualValues(t, "README.md", treeList[1].Path)
|
||||
assert.True(t, treeList[1].IsFile)
|
||||
assert.Empty(t, treeList[1].Children)
|
||||
|
||||
treeList, err = GetTreeInformation(ctx2, ctx2.Repo.Repository, "doc", refName)
|
||||
|
Loading…
x
Reference in New Issue
Block a user