mirror of
https://github.com/rclone/rclone.git
synced 2025-08-17 09:01:33 +02:00
lib/cache: add PutErr to put a value with an error into the cache
This commit is contained in:
16
lib/cache/cache_test.go
vendored
16
lib/cache/cache_test.go
vendored
@ -81,6 +81,22 @@ func TestGetError(t *testing.T) {
|
||||
assert.Equal(t, 0, len(c.cache))
|
||||
}
|
||||
|
||||
func TestPutErr(t *testing.T) {
|
||||
c, create := setup(t)
|
||||
|
||||
assert.Equal(t, 0, len(c.cache))
|
||||
|
||||
c.PutErr("/alien", "slime", errSentinel)
|
||||
|
||||
assert.Equal(t, 1, len(c.cache))
|
||||
|
||||
fNew, err := c.Get("/alien", create)
|
||||
require.Equal(t, errSentinel, err)
|
||||
require.Equal(t, "slime", fNew)
|
||||
|
||||
assert.Equal(t, 1, len(c.cache))
|
||||
}
|
||||
|
||||
func TestPut(t *testing.T) {
|
||||
c, create := setup(t)
|
||||
|
||||
|
Reference in New Issue
Block a user