mirror of
https://github.com/rclone/rclone.git
synced 2025-08-13 23:38:51 +02:00
vfs: convert vfs options to new style
This also - move in use options (Opt) from vfsflags to vfscommon - change os.FileMode to vfscommon.FileMode in parameters - rework vfscommon.FileMode and add tests
This commit is contained in:
@ -138,10 +138,8 @@ func TestVFSNew(t *testing.T) {
|
||||
r, vfs := newTestVFS(t)
|
||||
|
||||
// Check making a VFS with nil options
|
||||
var defaultOpt = vfscommon.DefaultOpt
|
||||
defaultOpt.DirPerms |= os.ModeDir
|
||||
assert.Equal(t, vfs.Opt, defaultOpt)
|
||||
assert.Equal(t, vfs.f, r.Fremote)
|
||||
var defaultOpt = vfscommon.Opt
|
||||
defaultOpt.Init()
|
||||
|
||||
checkActiveCacheEntries(1)
|
||||
|
||||
@ -164,14 +162,14 @@ func TestVFSNew(t *testing.T) {
|
||||
|
||||
// TestVFSNewWithOpts sees if the New command works properly
|
||||
func TestVFSNewWithOpts(t *testing.T) {
|
||||
var opt = vfscommon.DefaultOpt
|
||||
var opt = vfscommon.Opt
|
||||
opt.DirPerms = 0777
|
||||
opt.FilePerms = 0666
|
||||
opt.Umask = 0002
|
||||
_, vfs := newTestVFSOpt(t, &opt)
|
||||
|
||||
assert.Equal(t, os.FileMode(0775)|os.ModeDir, vfs.Opt.DirPerms)
|
||||
assert.Equal(t, os.FileMode(0664), vfs.Opt.FilePerms)
|
||||
assert.Equal(t, vfscommon.FileMode(0775)|vfscommon.FileMode(os.ModeDir), vfs.Opt.DirPerms)
|
||||
assert.Equal(t, vfscommon.FileMode(0664), vfs.Opt.FilePerms)
|
||||
}
|
||||
|
||||
// TestVFSRoot checks root directory is present and correct
|
||||
@ -182,7 +180,7 @@ func TestVFSRoot(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, vfs.root, root)
|
||||
assert.True(t, root.IsDir())
|
||||
assert.Equal(t, vfs.Opt.DirPerms.Perm(), root.Mode().Perm())
|
||||
assert.Equal(t, os.FileMode(vfs.Opt.DirPerms).Perm(), root.Mode().Perm())
|
||||
}
|
||||
|
||||
func TestVFSStat(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user