2020-03-27 11:12:21 +00:00
|
|
|
package readers
|
|
|
|
|
|
|
|
import (
|
2021-11-04 10:12:57 +00:00
|
|
|
"errors"
|
2020-03-27 11:12:21 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"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)
|
|
|
|
}
|