File: error_test.go

package info (click to toggle)
golang-github-hashicorp-go-plugin 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 552 kB
  • sloc: python: 38; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 441 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package plugin

import (
	"errors"
	"testing"
)

func TestBasicError_ImplementsError(t *testing.T) {
	var _ error = new(BasicError)
}

func TestBasicError_MatchesMessage(t *testing.T) {
	err := errors.New("foo")
	wrapped := NewBasicError(err)

	if wrapped.Error() != err.Error() {
		t.Fatalf("bad: %#v", wrapped.Error())
	}
}

func TestNewBasicError_nil(t *testing.T) {
	r := NewBasicError(nil)
	if r != nil {
		t.Fatalf("bad: %#v", r)
	}
}