示例#1
0
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)
	}
}
示例#2
0
文件: main.go 项目: mabetle/mcore
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
}