efritz/go-mockgen

View on GitHub
matchers/anything_matcher.go

Summary

Maintainability
A
0 mins
Test Coverage
package matchers

import (
    "fmt"

    "github.com/onsi/gomega/format"
    "github.com/onsi/gomega/types"
)

type anythingMatcher struct {
    n int
}

func BeAnything() types.GomegaMatcher {
    return &anythingMatcher{}
}

func (m *anythingMatcher) Match(actual interface{}) (bool, error) {
    return true, nil
}

func (m *anythingMatcher) FailureMessage(actual interface{}) string {
    return fmt.Sprintf("Expected\n%s\nto be anything", format.Object(actual, 1))
}

func (m *anythingMatcher) NegatedFailureMessage(actual interface{}) string {
    return fmt.Sprintf("Expected\n%s\nnot to be anything", format.Object(actual, 1))
}