Add the first test case.

This commit is contained in:
zicla
2019-04-25 19:52:38 +08:00
parent ff91e2aa38
commit dc3e570067
5 changed files with 508 additions and 505 deletions

View File

@ -18,17 +18,6 @@ type LiveProp struct {
dir bool
}
// SlashClean is equivalent to but slightly more efficient than
// path.Clean("/" + name).
func SlashClean(name string) string {
if name == "" || name[0] != '/' {
name = "/" + name
}
return path.Clean(name)
}
//所有的动态属性定义及其值的获取方式
var LivePropMap = map[xml.Name]LiveProp{
{Space: "DAV:", Local: "resourcetype"}: {
@ -43,7 +32,7 @@ var LivePropMap = map[xml.Name]LiveProp{
},
{Space: "DAV:", Local: "displayname"}: {
findFn: func(user *User, matter *Matter) string {
if SlashClean(matter.Name) == "/" {
if path.Clean("/"+matter.Name) == "/" {
return ""
} else {
return dav.EscapeXML(matter.Name)
@ -131,5 +120,4 @@ var LivePropMap = map[xml.Name]LiveProp{
},
dir: true,
},
}