zfs-localpv/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go
Pawan c3c5eb1794 test(zfspv): vendor for ginkgo test code
Signed-off-by: Pawan <pawan@mayadata.io>
2019-12-04 13:17:04 +05:30

28 lines
627 B
Go

// untested sections: 2
package matchers
import (
"fmt"
"github.com/onsi/gomega/format"
)
type BeTrueMatcher struct {
}
func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) {
if !isBool(actual) {
return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1))
}
return actual.(bool), nil
}
func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) {
return format.Message(actual, "to be true")
}
func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) {
return format.Message(actual, "not to be true")
}