chore: 初始化 Cloudreve 源码仓库
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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 TestRemoveSlash(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
asserts.Equal("/", RemoveSlash("/"))
|
||||
asserts.Equal("/123/1236", RemoveSlash("/123/1236"))
|
||||
asserts.Equal("/123/1236", RemoveSlash("/123/1236/"))
|
||||
}
|
||||
|
||||
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"))
|
||||
}
|
||||
Reference in New Issue
Block a user