func TestNew(t *testing.T) {
	const errStr = "foo bar baz"
	e := stackerr.New(errStr)
	matches := []string{
		errStr,
		"^github.com/facebookgo/stackerr/stackerr_test.go:15 +TestNew$",
	}
	match(t, e.Error(), matches)
}
Example #2
0
// New returns an error that contains a stack trace (in debug mode)
func New(s string) error {
	if util.Debug {
		return stackerr.New(s)
	}
	return errors.New(s)
}
func TestLog(t *testing.T) {
	t.Log(stackerr.New("hello"))
}
func TestDoubleWrap(t *testing.T) {
	e := stackerr.New("")
	if stackerr.WrapSkip(e, 1) != e {
		t.Fatal("double wrap failure")
	}
}