//provide test coverage of reader errors in multi-block requests
provide test coverage of reader errors in multi-block requests
// provide test coverage of reader errors in multi - block requests
func TestRangeErrors(t *testing.T) {
	er := EReader{
		delay:  100 * time.Millisecond,
		errbuf: []byte("abcd-efgh-ijkl-m"),
	}
	bc, _ := NewAdapter(er, BlockSize("5"))
	wg := sync.WaitGroup{}
	wg.Add(2)
	go func() {
		defer wg.Done()
		buf := make([]byte, 15)
		_, err := bc.ReadAt("", buf, 0)
		assert.NoError(t, err)
	}()
	time.Sleep(5 * time.Millisecond)
	go func() {
		defer wg.Done()
		buf := make([]byte, 7)
		_, err := bc.ReadAt("", buf, 11)
		assert.ErrorIs(t, err, io.EOF)
	}()
	wg.Wait()
	er = EReader{
		delay:  100 * time.Millisecond,
		errbuf: []byte("abcd-efgh-ijkl-m"),
		erroff: 15,
		err:    fmt.Errorf("foo"),
	}
	bc, _ = NewAdapter(er, BlockSize("5"))
	wg.Add(2)
	go func() {
		defer wg.Done()
		buf := make([]byte, 15)
		_, err := bc.ReadAt("", buf, 0)
		assert.NoError(t, err)
	}()
	time.Sleep(5 * time.Millisecond)
	go func() {
		defer wg.Done()
		buf := make([]byte, 15)
		_, err := bc.ReadAt("", buf, 6)
		assert.Equal(t, "foo", err.Error())
	}()
	wg.Wait()
}
func TestRangeErrors ( t * testing . T ) { er := EReader { delay : 100 * time . Millisecond , errbuf : [ ] byte ( " " ) , } bc , _ := NewAdapter ( er , BlockSize ( " " ) ) wg := sync . WaitGroup { } wg . Add ( 2 ) go func ( ) { defer wg . Done ( ) buf := make ( [ ] byte , 15 ) _ , err := bc . ReadAt ( " " , buf , 0 ) assert . NoError ( t , err ) } ( ) time . Sleep ( 5 * time . Millisecond ) go func ( ) { defer wg . Done ( ) buf := make ( [ ] byte , 7 ) _ , err := bc . ReadAt ( " " , buf , 11 ) assert . ErrorIs ( t , err , io . EOF ) } ( ) wg . Wait ( ) er = EReader { delay : 100 * time . Millisecond , errbuf : [ ] byte ( " " ) , erroff : 15 , err : fmt . Errorf ( " " ) , } bc , _ = NewAdapter ( er , BlockSize ( " " ) ) wg . Add ( 2 ) go func ( ) { defer wg . Done ( ) buf := make ( [ ] byte , 15 ) _ , err := bc . ReadAt ( " " , buf , 0 ) assert . NoError ( t , err ) } ( ) time . Sleep ( 5 * time . Millisecond ) go func ( ) { defer wg . Done ( ) buf := make ( [ ] byte , 15 ) _ , err := bc . ReadAt ( " " , buf , 6 ) assert . Equal ( t , " " , err . Error ( ) ) } ( ) wg . Wait ( ) }
provide test coverage of reader errors in multi-block requests
provide test coverage of reader errors in multi - block requests
//check small last block //check reader error returned