github.com/xsb/terraform@v0.6.13-0.20160314145438-fe415c2f09d7/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 }