Path: blob/main/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go
2880 views
// untested sections: 212package matchers34import (5"fmt"67"github.com/onsi/gomega/format"8)910type BeTrueMatcher struct {11Reason string12}1314func (matcher *BeTrueMatcher) Match(actual any) (success bool, err error) {15if !isBool(actual) {16return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1))17}1819return actual.(bool), nil20}2122func (matcher *BeTrueMatcher) FailureMessage(actual any) (message string) {23if matcher.Reason == "" {24return format.Message(actual, "to be true")25} else {26return matcher.Reason27}28}2930func (matcher *BeTrueMatcher) NegatedFailureMessage(actual any) (message string) {31if matcher.Reason == "" {32return format.Message(actual, "not to be true")33} else {34return fmt.Sprintf(`Expected not true but got true\nNegation of "%s" failed`, matcher.Reason)35}36}373839