package main import ( "testing" ) type Type int const ( TypeChild Type = iota TypeChildren TypeAllChildren ) type Node struct { Prev *Node Next *Node Name []byte Type Type } // func extractPath(cur *Node) string { // var path []byte // if cur.Next.Next == nil { // return "/" // } // for ; cur != nil; cur = cur.Next { // path = append(path, cur.Name...) // if cur.Next.Next == nil { // break // } // path = append(path, '/') // } // return string(path) // } func xPath(spath string) string { var path []byte = make([]byte, len(spath)) copy(path, spath) for i := 0; i < len(path); i++ { c := path[i] if c == '/' { } } } func TestMain(t *testing.T) { // t.Error(xPath("/a/../../b/../c//.//")) // t.Error(xPath("/a/./b/../../c/")) // t.Error(xPath("/")) // t.Error(xPath("/a//b////c/d//././/..")) }