7 "github.com/onsi/gomega/format"
10 type BeIdenticalToMatcher struct {
14 func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) {
15 if actual == nil && matcher.Expected == nil {
16 return false, fmt.Errorf("Refusing to compare <nil> to <nil>.\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.")
20 if r := recover(); r != nil {
21 if _, ok := r.(runtime.Error); ok {
28 return actual == matcher.Expected, nil
31 func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string {
32 return format.Message(actual, "to be identical to", matcher.Expected)
35 func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string {
36 return format.Message(actual, "not to be identical to", matcher.Expected)