func TestJoinPath(t *testing.T) { if "a/b/c.txt" != mcore.JoinPath("a", "b", "c.txt") { t.Error("join path failed") } a := mcore.JoinPath("a.txt") t.Log(a) if "a.txt" != a { t.Error(a) } }
func demoJoinPath() { fmt.Printf("%s\n", mcore.JoinPath("c.txt")) // a/b/c.txt fmt.Printf("%s\n", mcore.JoinPath("a", "b", "c.txt")) // a/b/c.txt fmt.Printf("%s\n", mcore.JoinPath("$HOME", "b", "c.txt")) // a/b/c.txt fmt.Printf("%s\n", mcore.JoinPath("$HOME", "$GOPATH", "c.txt")) // a/b/c.txt }