-
Notifications
You must be signed in to change notification settings - Fork 0
/
localfilesystem_test.go
37 lines (28 loc) · 923 Bytes
/
localfilesystem_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package fs
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_LocalFileSystem_MakeAllDirs(t *testing.T) {
const testDir = "TestDir"
File(testDir).RemoveRecursive()
defer File(testDir).RemoveRecursive()
localFileSystem := LocalFileSystem{
DefaultCreatePermissions: UserAndGroupReadWrite,
DefaultCreateDirPermissions: UserAndGroupReadWrite,
}
err := localFileSystem.MakeDir(testDir, []Permissions{AllReadWrite})
assert.NoError(t, err)
}
func Test_LocalFileSystem_SplitDirAndName(t *testing.T) {
root := Local.Separator()
dir, name := Local.SplitDirAndName(root)
assert.Equal(t, root, dir)
assert.Equal(t, "", name)
dir, name = Local.SplitDirAndName(root + "FileInRoot")
assert.Equal(t, root, dir)
assert.Equal(t, "FileInRoot", name)
dir, name = Local.SplitDirAndName(root + "FileInRoot" + Local.Separator())
assert.Equal(t, root, dir)
assert.Equal(t, "FileInRoot", name)
}