assert - Assertion in non-test function in Go -
i want use assertion in function, not test function. normal function, , want use assert.equal(param1, some_constant)
. came across following package: https://godoc.org/github.com/stretchr/testify/assert though, appears requires testing
package, , give function parameter of type *testing.t
. there other assert function in go, can directly call assert
function without relying on other testing package or parameter?
go not provide assertions. there section in language faq go team here: https://golang.org/doc/faq#assertions if it, can write normal function accepts 2 values , if evaluate equal or not equal, desire.
Comments
Post a Comment