github.com/fluxrad/terraform@v0.6.4-0.20150906191316-06627ccf39fa/rpc/error_test.go (about)

     1  package rpc
     2  
     3  import (
     4  	"errors"
     5  	"testing"
     6  )
     7  
     8  func TestBasicError_ImplementsError(t *testing.T) {
     9  	var _ error = new(BasicError)
    10  }
    11  
    12  func TestBasicError_MatchesMessage(t *testing.T) {
    13  	err := errors.New("foo")
    14  	wrapped := NewBasicError(err)
    15  
    16  	if wrapped.Error() != err.Error() {
    17  		t.Fatalf("bad: %#v", wrapped.Error())
    18  	}
    19  }
    20  
    21  func TestNewBasicError_nil(t *testing.T) {
    22  	r := NewBasicError(nil)
    23  	if r != nil {
    24  		t.Fatalf("bad: %#v", r)
    25  	}
    26  }