Test: remove test for internal xml package

This commit is contained in:
HFO4
2019-12-21 13:01:18 +08:00
parent 91b873065a
commit bb27d1d587
8 changed files with 27 additions and 3643 deletions

View File

@@ -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")
}
}

View File

@@ -16,7 +16,6 @@ func FillSlash(path string) string {
}
// RemoveSlash 移除路径最后的`/`
// TODO 测试
func RemoveSlash(path string) string {
if len(path) > 1 {
return strings.TrimSuffix(path, "/")

View File

@@ -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(""))