alist/pkg/utils/path_test.go

23 lines
516 B
Go
Raw Permalink Normal View History

2022-08-11 12:32:17 +00:00
package utils
import "testing"
func TestEncodePath(t *testing.T) {
t.Log(EncodePath("http://localhost:5244/d/123#.png"))
}
func TestFixAndCleanPath(t *testing.T) {
datas := map[string]string{
"": "/",
".././": "/",
"../../.../": "/...",
"x//\\y/": "/x/y",
".././.x/.y/.//..x../..y..": "/.x/.y/..x../..y..",
}
for key, value := range datas {
if FixAndCleanPath(key) != value {
t.Logf("raw %s fix fail", key)
}
}
}