31 lines
491 B
Go
Executable File
31 lines
491 B
Go
Executable File
package filetree
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestPaths(t *testing.T) {
|
|
paths := Paths([]Path{
|
|
NewPathFromURL("/notes/a/b"),
|
|
NewPathFromURL("/notes/c/d"),
|
|
NewPathFromURL("/notes/e/f"),
|
|
})
|
|
|
|
list := paths.List()
|
|
if strings.Count(list, "<li>") != 3 {
|
|
t.Error(list)
|
|
}
|
|
if !strings.Contains(list, ">f") {
|
|
t.Error(list)
|
|
}
|
|
|
|
list = paths.List(true)
|
|
if strings.Count(list, "<li>") != 3 {
|
|
t.Error(list)
|
|
}
|
|
if !strings.Contains(list, ">/notes/a") {
|
|
t.Error(list)
|
|
}
|
|
}
|