notes-server/filetree/files_test.go

29 lines
480 B
Go
Executable File

package filetree
import (
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"testing"
)
func TestFiles(t *testing.T) {
config.Root = "/"
files := NewFiles()
info, err := os.Stat("/etc/hosts")
if err != nil {
t.Fatal(err)
}
p := NewPathFromLocal("/etc")
files.Push(p, info)
if len([]Path(*files)) != 1 {
t.Error(files)
}
first := []Path(*files)[0]
if first.Base != "hosts" {
t.Error(first)
}
if first.Local != "/etc/hosts" {
t.Error(first)
}
}