github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/lib/readers/error_test.go (about)

     1  package readers
     2  
     3  import (
     4  	"errors"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestErrorReader(t *testing.T) {
    11  	errRead := errors.New("boom")
    12  	r := ErrorReader{errRead}
    13  
    14  	buf := make([]byte, 16)
    15  	n, err := r.Read(buf)
    16  	assert.Equal(t, errRead, err)
    17  	assert.Equal(t, 0, n)
    18  }