github.com/jerryclinesmith/packer@v0.3.7/packer/rpc/error_test.go (about)

     1  package rpc
     2  
     3  import (
     4  	"cgl.tideland.biz/asserts"
     5  	"errors"
     6  	"testing"
     7  )
     8  
     9  func TestBasicError_ImplementsError(t *testing.T) {
    10  	assert := asserts.NewTestingAsserts(t, true)
    11  
    12  	var r error
    13  	e := &BasicError{""}
    14  
    15  	assert.Implementor(e, &r, "should be an error")
    16  }
    17  
    18  func TestBasicError_MatchesMessage(t *testing.T) {
    19  	assert := asserts.NewTestingAsserts(t, true)
    20  
    21  	err := errors.New("foo")
    22  	wrapped := NewBasicError(err)
    23  
    24  	assert.Equal(wrapped.Error(), err.Error(), "should have the same error")
    25  }