mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 01:47:51 +08:00
27 lines
539 B
Go
27 lines
539 B
Go
|
package store
|
||
|
|
||
|
import (
|
||
|
"reflect"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
dirsToAdd = []string{"/usr", "/usr/bin", "/usr"}
|
||
|
wantedDirs = []Dir{Dir{"/usr", 20}, Dir{"/usr/bin", 10}}
|
||
|
)
|
||
|
|
||
|
func TestDir(t *testing.T) {
|
||
|
for _, path := range dirsToAdd {
|
||
|
err := tStore.AddDir(path)
|
||
|
if err != nil {
|
||
|
t.Errorf("tStore.AddDir(%q) => %v, want <nil>", path, err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
dirs, err := tStore.FindDirs("usr")
|
||
|
if err != nil || !reflect.DeepEqual(dirs, wantedDirs) {
|
||
|
t.Errorf(`tStore.FindDirs("usr") => (%v, %v), want (%v, <nil>)`,
|
||
|
dirs, err, wantedDirs)
|
||
|
}
|
||
|
}
|