Test: remove test for internal xml package
This commit is contained in:
@@ -10,3 +10,23 @@ func TestExists(t *testing.T) {
|
||||
asserts.True(Exists("io_test.go"))
|
||||
asserts.False(Exists("io_test.js"))
|
||||
}
|
||||
|
||||
func TestCreatNestedFile(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
|
||||
// 父目录不存在
|
||||
{
|
||||
file, err := CreatNestedFile("test/nest.txt")
|
||||
asserts.NoError(err)
|
||||
asserts.NoError(file.Close())
|
||||
asserts.FileExists("test/nest.txt")
|
||||
}
|
||||
|
||||
// 父目录存在
|
||||
{
|
||||
file, err := CreatNestedFile("test/direct.txt")
|
||||
asserts.NoError(err)
|
||||
asserts.NoError(file.Close())
|
||||
asserts.FileExists("test/direct.txt")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ func FillSlash(path string) string {
|
||||
}
|
||||
|
||||
// RemoveSlash 移除路径最后的`/`
|
||||
// TODO 测试
|
||||
func RemoveSlash(path string) string {
|
||||
if len(path) > 1 {
|
||||
return strings.TrimSuffix(path, "/")
|
||||
|
||||
@@ -20,6 +20,13 @@ func TestFillSlash(t *testing.T) {
|
||||
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(""))
|
||||
|
||||
Reference in New Issue
Block a user