mirror of
https://github.com/rclone/rclone.git
synced 2025-12-24 04:04:37 +00:00
vfs: add tests and subsequent fixes
* Tests for VFS layer * Small fixes found during testing * Fix Close, Flush and Release behaviour for ReadFileHandle and WriteFileHandle * Fix nil object bugs on File
This commit is contained in:
29
vfs/createinfo_test.go
Normal file
29
vfs/createinfo_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package vfs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCreateInfo(t *testing.T) {
|
||||
r := fstest.NewRun(t)
|
||||
defer r.Finalise()
|
||||
|
||||
remote := "file/to/be/created"
|
||||
ci := newCreateInfo(r.Fremote, remote)
|
||||
|
||||
// Test methods
|
||||
assert.Equal(t, r.Fremote, ci.Fs())
|
||||
assert.Equal(t, remote, ci.String())
|
||||
assert.Equal(t, remote, ci.Remote())
|
||||
_, err := ci.Hash(fs.HashMD5)
|
||||
assert.Equal(t, fs.ErrHashUnsupported, err)
|
||||
assert.WithinDuration(t, time.Now(), ci.ModTime(), time.Second)
|
||||
assert.Equal(t, int64(0), ci.Size())
|
||||
assert.Equal(t, true, ci.Storable())
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user