aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-faster/errors/cause_test.go
blob: 641baf59b13ba3ee5004e6b52a45bef6f5e48ec7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package errors

import (
	"fmt"
	"reflect"
	"testing"
)

func TestCause(t *testing.T) {
	err1 := fmt.Errorf("1")
	erra := Wrap(err1, "wrap 2")
	errb := Wrap(erra, "wrap3")

	v, ok := Cause(errb)
	if !ok {
		t.Error("unexpected false")
		return
	}
	if !reflect.DeepEqual(v, erra.(*wrapError).frame) {
		t.Errorf("want %+v, got %+v", v, erra.(*wrapError).frame)
	}
}