github.com/wzzhu/tensor@v0.9.24/internal/storage/keepsync_test.go (about)

     1  package storage
     2  
     3  import (
     4  	"github.com/pkg/errors"
     5  	"github.com/stretchr/testify/assert"
     6  	"testing"
     7  )
     8  
     9  type noopError struct{}
    10  
    11  func (e noopError) NoOp() bool    { return true }
    12  func (e noopError) Error() string { return "NoOp" }
    13  
    14  func TestHandleNoOp(t *testing.T) {
    15  	otherErr := errors.New("other error")
    16  
    17  	assert.Equal(t, nil, handleNoOp(noopError{}))
    18  	assert.Equal(t, nil, handleNoOp(nil))
    19  	assert.Equal(t, otherErr, handleNoOp(otherErr))
    20  }