Path: blob/main/vendor/github.com/onsi/gomega/matchers/be_identical_to.go
2880 views
// untested sections: 212package matchers34import (5"fmt"6"runtime"78"github.com/onsi/gomega/format"9)1011type BeIdenticalToMatcher struct {12Expected any13}1415func (matcher *BeIdenticalToMatcher) Match(actual any) (success bool, matchErr error) {16if actual == nil && matcher.Expected == nil {17return 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.")18}1920defer func() {21if r := recover(); r != nil {22if _, ok := r.(runtime.Error); ok {23success = false24matchErr = nil25}26}27}()2829return actual == matcher.Expected, nil30}3132func (matcher *BeIdenticalToMatcher) FailureMessage(actual any) string {33return format.Message(actual, "to be identical to", matcher.Expected)34}3536func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual any) string {37return format.Message(actual, "not to be identical to", matcher.Expected)38}394041