working commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCopy(t *testing.T) {
|
||||
srcsize := 1024 + 145
|
||||
srcdata := make([]byte, srcsize)
|
||||
_, err := rand.Read(srcdata)
|
||||
require.NoError(t, err)
|
||||
|
||||
src := bytes.NewReader(srcdata)
|
||||
dst := bytes.NewBuffer(nil)
|
||||
|
||||
ctx := context.Background()
|
||||
recsize, err := Copy(ctx, dst, src)
|
||||
require.NoError(t, err)
|
||||
|
||||
fmt.Printf("Size: %d %d\n", recsize, srcsize)
|
||||
require.Equal(t, int64(srcsize), recsize)
|
||||
}
|
||||
Reference in New Issue
Block a user