mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-07-11 10:00:21 +02:00

List the folders in arrival order when dirstore.List() is called instead of returning it in an arbitrary order. If enable-folders-sort=false and dirlist-tree=false, the directory list will arbitrarly reshuffle when changing directories because the dirlist.dirs are generated from keys in a map in the dirstore. Fixes: https://todo.sr.ht/~rjarry/aerc/178 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
23 lines
448 B
Go
23 lines
448 B
Go
package lib_test
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"git.sr.ht/~rjarry/aerc/lib"
|
|
"git.sr.ht/~rjarry/aerc/models"
|
|
)
|
|
|
|
func TestDirStore_List(t *testing.T) {
|
|
dirs := []string{"a/c", "x", "a/b", "d"}
|
|
dirstore := lib.NewDirStore()
|
|
for _, d := range dirs {
|
|
dirstore.SetMessageStore(&models.Directory{Name: d}, nil)
|
|
}
|
|
for i := 0; i < 10; i++ {
|
|
if !reflect.DeepEqual(dirstore.List(), dirs) {
|
|
t.Errorf("order does not match")
|
|
return
|
|
}
|
|
}
|
|
}
|