github.com/blend/go-sdk@v1.20220411.3/ratelimiter/copy_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package ratelimiter
     9  
    10  import (
    11  	"bytes"
    12  	"context"
    13  	"testing"
    14  
    15  	"github.com/blend/go-sdk/assert"
    16  )
    17  
    18  func Test_Copy(t *testing.T) {
    19  	its := assert.New(t)
    20  
    21  	src := bytes.NewBufferString("this is a test")
    22  	dst := new(bytes.Buffer)
    23  
    24  	n, err := Copy(context.Background(), dst, src)
    25  	its.Nil(err)
    26  	its.Equal(14, n)
    27  	its.Equal("this is a test", dst.String())
    28  }