You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDotPathToStandardPath(t *testing.T) {
|
|
|
|
asserts := assert.New(t)
|
|
|
|
|
|
|
|
asserts.Equal("/", DotPathToStandardPath(""))
|
|
|
|
asserts.Equal("/目录", DotPathToStandardPath("目录"))
|
|
|
|
asserts.Equal("/目录/目录2", DotPathToStandardPath("目录,目录2"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFillSlash(t *testing.T) {
|
|
|
|
asserts := assert.New(t)
|
|
|
|
asserts.Equal("/", FillSlash("/"))
|
|
|
|
asserts.Equal("/", FillSlash(""))
|
|
|
|
asserts.Equal("/123/", FillSlash("/123"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSplitPath(t *testing.T) {
|
|
|
|
asserts := assert.New(t)
|
|
|
|
asserts.Equal([]string{}, SplitPath(""))
|
|
|
|
asserts.Equal([]string{}, SplitPath("1"))
|
|
|
|
asserts.Equal([]string{"/"}, SplitPath("/"))
|
|
|
|
asserts.Equal([]string{"/", "123", "321"}, SplitPath("/123/321"))
|
|
|
|
}
|