From 6b4240ac0ae59ad6b818a7f72446557b9b20126a Mon Sep 17 00:00:00 2001 From: eson Date: Fri, 18 Sep 2020 18:58:49 +0800 Subject: [PATCH] init --- main_test.go | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 main_test.go diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..2480f24 --- /dev/null +++ b/main_test.go @@ -0,0 +1,57 @@ +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//././/..")) +}