testing filetree

This commit is contained in:
Bel LaPointe
2019-11-21 13:26:07 -07:00
parent a140d0eade
commit c88fed0929
3 changed files with 83 additions and 0 deletions

View File

@@ -1 +1,28 @@
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)
}
}