notes-server/filetree/dirs_test.go

29 lines
446 B
Go
Executable File

package filetree
import (
"local/notes-server/config"
"os"
"testing"
)
func TestDirs(t *testing.T) {
config.Root = "/"
dirs := NewDirs()
info, err := os.Stat("/usr/local")
if err != nil {
t.Fatal(err)
}
p := NewPathFromLocal("/usr")
dirs.Push(p, info)
if len([]Path(*dirs)) != 1 {
t.Error(dirs)
}
first := []Path(*dirs)[0]
if first.Base != "local" {
t.Error(first)
}
if first.Local != "/usr/local" {
t.Error(first)
}
}