github.com/hashicorp/go-plugin@v1.6.0/error_test.go (about)

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