@@ -87,14 +87,33 @@ func GotFormatterAdapter(s GotFormatter, m Matcher) Matcher {
8787 }
8888}
8989
90- type anyMatcher struct {}
90+ type anyMatcher struct {
91+ matchers []Matcher
92+ }
9193
92- func (anyMatcher ) Matches (interface {}) bool {
93- return true
94+ func (am anyMatcher ) Matches (x interface {}) bool {
95+ if len (am .matchers ) == 0 {
96+ return true
97+ }
98+
99+ for _ , m := range am .matchers {
100+ if m .Matches (x ) {
101+ return true
102+ }
103+ }
104+ return false
94105}
95106
96- func (anyMatcher ) String () string {
97- return "is anything"
107+ func (am anyMatcher ) String () string {
108+ if len (am .matchers ) == 0 {
109+ return "is anything"
110+ }
111+
112+ ss := make ([]string , 0 , len (am .matchers ))
113+ for _ , matcher := range am .matchers {
114+ ss = append (ss , matcher .String ())
115+ }
116+ return strings .Join (ss , " OR " )
98117}
99118
100119type eqMatcher struct {
@@ -273,12 +292,13 @@ func (m inAnyOrderMatcher) String() string {
273292
274293// Constructors
275294
276- // All returns a composite Matcher that returns true if and only all of the
295+ // All returns a composite Matcher that returns true if and only if all of the
277296// matchers return true.
278297func All (ms ... Matcher ) Matcher { return allMatcher {ms } }
279298
280- // Any returns a matcher that always matches.
281- func Any () Matcher { return anyMatcher {} }
299+ // All returns a composite Matcher that returns true if any of the
300+ // matchers return true.
301+ func Any (ms ... Matcher ) Matcher { return anyMatcher {ms } }
282302
283303// Eq returns a matcher that matches on equality.
284304//
0 commit comments