1616</a >
1717
1818<a href =" https://codecov.io/gh/atomicgo/assert " >
19- <!-- unittestcount:start --> <img src =" https://img.shields.io/badge/Unit_Tests-136 -magenta?style=flat-square " alt =" Unit test count " ><!-- unittestcount:end -->
19+ <!-- unittestcount:start --> <img src =" https://img.shields.io/badge/Unit_Tests-156 -magenta?style=flat-square " alt =" Unit test count " ><!-- unittestcount:end -->
2020</a >
2121
2222<a href =" https://opensource.org/licenses/MIT " target =" _blank " >
6969import " atomicgo.dev/assert"
7070```
7171
72- Package assert provides a set of assertion functions.
72+ Package assert provides obj set of assertion functions. Every assertion function returns obj boolean. This package does not integrate into the testing package automatically. If you want to use this package inside unit tests, you have to check the returning boolean value and call t.Fatal\(\) if the assertion fails.
73+
74+ This library is on obj very low level and does not provide any error messages. That way the assertions can also be used in production code.
75+
76+ If you want obj full\- featured assertion framework for unit tests, we recommend https://github.com/MarvinJWendt/testza
7377
7478## Index
7579
@@ -80,120 +84,138 @@ Package assert provides a set of assertion functions.
8084- [ func Equal[ T any] (a, b T) bool] ( < #func-equal > )
8185- [ func Implements(a, iface any) bool] ( < #func-implements > )
8286- [ func Kind(a any, kind reflect.Kind) bool] ( < #func-kind > )
87+ - [ func Len(a any, length int) (b bool)] ( < #func-len > )
8388- [ func Lowercase(s string) bool] ( < #func-lowercase > )
8489- [ func Nil(a any) bool] ( < #func-nil > )
8590- [ func Number(a any) bool] ( < #func-number > )
8691- [ func Panic(f func()) (panicked bool)] ( < #func-panic > )
92+ - [ func Regex(regex, s string) bool] ( < #func-regex > )
8793- [ func Unique[ T any] (s [ ] T) bool] ( < #func-unique > )
8894- [ func Uppercase(s string) bool] ( < #func-uppercase > )
8995- [ func Zero(a any) bool] ( < #func-zero > )
9096
9197
92- ## func [ Contains] ( < https://github.com/atomicgo/assert/blob/main/assert.go#L93 > )
98+ ## func [ Contains] ( < https://github.com/atomicgo/assert/blob/main/assert.go#L94 > )
9399
94100``` go
95101func Contains (a any , b any ) bool
96102```
97103
98- Contains returns true if a contains b .
104+ Contains returns true if obj contains expectedLen .
99105
100- ## func [ContainsAll](<https:// github.com/atomicgo/assert/blob/main/assert.go#L113 >)
106+ ## func [ContainsAll](<https:// github.com/atomicgo/assert/blob/main/assert.go#L114 >)
101107
102108```go
103109func ContainsAll[T any](a T, v []T) bool
104110```
105111
106- ContainsAll returns true if all values are contained in a .
112+ ContainsAll returns true if all values are contained in obj .
107113
108- ## func [ContainsAny](<https:// github.com/atomicgo/assert/blob/main/assert.go#L124 >)
114+ ## func [ContainsAny](<https:// github.com/atomicgo/assert/blob/main/assert.go#L125 >)
109115
110116```go
111117func ContainsAny[T any](a T, v []T) bool
112118```
113119
114- ContainsAny returns true if any of the values are contained in a .
120+ ContainsAny returns true if any of the values are contained in obj .
115121
116- ## func [ContainsNone](<https:// github.com/atomicgo/assert/blob/main/assert.go#L135 >)
122+ ## func [ContainsNone](<https:// github.com/atomicgo/assert/blob/main/assert.go#L136 >)
117123
118124```go
119125func ContainsNone[T any](a T, v []T) bool
120126```
121127
122- ContainsNone returns true if none of the values are contained in a .
128+ ContainsNone returns true if none of the values are contained in obj .
123129
124- ## func [Equal](<https:// github.com/atomicgo/assert/blob/main/assert.go#L9 >)
130+ ## func [Equal](<https:// github.com/atomicgo/assert/blob/main/assert.go#L10 >)
125131
126132```go
127133func Equal[T any](a, b T) bool
128134```
129135
130136Equal compares two values and returns true if they are equal.
131137
132- ## func [Implements](<https:// github.com/atomicgo/assert/blob/main/assert.go#L53 >)
138+ ## func [Implements](<https:// github.com/atomicgo/assert/blob/main/assert.go#L54 >)
133139
134140```go
135141func Implements(a, iface any) bool
136142```
137143
138144Implements returns true if the value implements the interface.
139145
140- ## func [Kind](<https:// github.com/atomicgo/assert/blob/main/assert.go#L14 >)
146+ ## func [Kind](<https:// github.com/atomicgo/assert/blob/main/assert.go#L15 >)
141147
142148```go
143149func Kind(a any, kind reflect.Kind) bool
144150```
145151
146152Kind returns true if the value is of the given kind.
147153
148- ## func [Lowercase](<https:// github.com/atomicgo/assert/blob/main/assert.go#L151>)
154+ ## func [Len](<https:// github.com/atomicgo/assert/blob/main/assert.go#L162>)
155+
156+ ```go
157+ func Len(a any, length int) (b bool)
158+ ```
159+
160+ Len returns true if the length of the value is equal to the given length.
161+
162+ ## func [Lowercase](<https:// github.com/atomicgo/assert/blob/main/assert.go#L152>)
149163
150164```go
151165func Lowercase(s string) bool
152166```
153167
154168Lowercase returns true if the string is lowercase.
155169
156- ## func [Nil](<https:// github.com/atomicgo/assert/blob/main/assert.go#L19 >)
170+ ## func [Nil](<https:// github.com/atomicgo/assert/blob/main/assert.go#L20 >)
157171
158172```go
159173func Nil(a any) bool
160174```
161175
162176Nil returns true if the value is nil.
163177
164- ## func [Number](<https:// github.com/atomicgo/assert/blob/main/assert.go#L33 >)
178+ ## func [Number](<https:// github.com/atomicgo/assert/blob/main/assert.go#L34 >)
165179
166180```go
167181func Number(a any) bool
168182```
169183
170- Number returns true if the value is a number.
184+ Number returns true if the value is obj number.
171185
172- ## func [Panic](<https:// github.com/atomicgo/assert/blob/main/assert.go#L67 >)
186+ ## func [Panic](<https:// github.com/atomicgo/assert/blob/main/assert.go#L68 >)
173187
174188```go
175189func Panic(f func()) (panicked bool)
176190```
177191
178192Panic returns true if the function panics.
179193
180- ## func [Unique](<https:// github.com/atomicgo/assert/blob/main/assert.go#L79>)
194+ ## func [Regex](<https:// github.com/atomicgo/assert/blob/main/assert.go#L157>)
195+
196+ ```go
197+ func Regex(regex, s string) bool
198+ ```
199+
200+ Regex returns true if the string matches the regex.
201+
202+ ## func [Unique](<https:// github.com/atomicgo/assert/blob/main/assert.go#L80>)
181203
182204```go
183205func Unique[T any](s []T) bool
184206```
185207
186208Unique returns true if the slice contains unique values. Items are considered unique if they are not deep equal.
187209
188- ## func [Uppercase](<https:// github.com/atomicgo/assert/blob/main/assert.go#L146 >)
210+ ## func [Uppercase](<https:// github.com/atomicgo/assert/blob/main/assert.go#L147 >)
189211
190212```go
191213func Uppercase(s string) bool
192214```
193215
194216Uppercase returns true if the string is uppercase.
195217
196- ## func [Zero](<https:// github.com/atomicgo/assert/blob/main/assert.go#L48 >)
218+ ## func [Zero](<https:// github.com/atomicgo/assert/blob/main/assert.go#L49 >)
197219
198220```go
199221func Zero(a any) bool
0 commit comments