@@ -90,7 +90,7 @@ func (x FluentMap[K, V]) NotContainPair(k K, v V, opts ...cmp.Option) FailureMes
9090 return FailureMessage (fmt .Sprintf ("contains the pair\n got: %+v\n key: %+v\n value: %+v" , x .Got , k , v ))
9191}
9292
93- // Any tests if any of the slice 's item meets the predicate criteria.
93+ // Any tests if any of the map 's pairs meets the predicate criteria.
9494func (x FluentMap [K , V ]) Any (predicate func (K , V ) bool ) FailureMessage {
9595 for k , v := range x .Got {
9696 if predicate (k , v ) {
@@ -100,7 +100,7 @@ func (x FluentMap[K, V]) Any(predicate func(K, V) bool) FailureMessage {
100100 return FailureMessage (fmt .Sprintf ("none pair does meet the predicate criteria\n got: %+v" , x .Got ))
101101}
102102
103- // All tests if all of the slice 's items meets the predicate criteria.
103+ // All tests if all of the map 's pairs meet the predicate criteria.
104104func (x FluentMap [K , V ]) All (predicate func (K , V ) bool ) FailureMessage {
105105 for k , v := range x .Got {
106106 if ! predicate (k , v ) {
@@ -110,7 +110,7 @@ func (x FluentMap[K, V]) All(predicate func(K, V) bool) FailureMessage {
110110 return ""
111111}
112112
113- // None tests if all of the slice 's item does not meet the predicate criteria.
113+ // None tests if none of the map 's pairs meets the predicate criteria.
114114func (x FluentMap [K , V ]) None (predicate func (K , V ) bool ) FailureMessage {
115115 for k , v := range x .Got {
116116 if predicate (k , v ) {
@@ -119,3 +119,12 @@ func (x FluentMap[K, V]) None(predicate func(K, V) bool) FailureMessage {
119119 }
120120 return ""
121121}
122+
123+ // Len tests the length of the map.
124+ func (x FluentMap [K , V ]) Len (want int ) FailureMessage {
125+ gotLen := len (x .Got )
126+ if gotLen != want {
127+ return FailureMessage (fmt .Sprintf ("has different length\n got: %+v\n len: %v\n want: %v" , x .Got , gotLen , want ))
128+ }
129+ return ""
130+ }
0 commit comments