mirror of
https://github.com/rclone/rclone.git
synced 2025-08-14 07:49:00 +02:00
lib/readers: factor ErrorReader from multiple sources
This commit is contained in:
18
lib/readers/error_test.go
Normal file
18
lib/readers/error_test.go
Normal file
@ -0,0 +1,18 @@
|
||||
package readers
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestErrorReader(t *testing.T) {
|
||||
errRead := errors.New("boom")
|
||||
r := ErrorReader{errRead}
|
||||
|
||||
buf := make([]byte, 16)
|
||||
n, err := r.Read(buf)
|
||||
assert.Equal(t, errRead, err)
|
||||
assert.Equal(t, 0, n)
|
||||
}
|
Reference in New Issue
Block a user