-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: add assert
function
#21015
Comments
assert
function to testing standard libraryassert
function
I don't think we'd do this before Go had generics (#15292) even if we did. I don't know what's changed from previous times when this has been rejected. (usual argument I see is that testing assertion libraries become little DSLs and medium DSLs and then it's a whole new language you're using instead of using the language that the rest of your program is written in) I'm going to place this on hold until #15292 makes some progress, though. In the meantime you can use https://github.com/stretchr/testify etc. |
Right, thanks. I forgot this was in the FAQ, as you've found: https://golang.org/doc/faq#testing_framework |
@bradfitz ah, thanks. I shall read all of that before filing future issues. 😄 |
I also think I think following function prototypes are better than the one is suggested.
https://github.com/bronze1man/kmg/blob/master/kmgTest/testV2.go#L11 |
Nothing to do here. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8.3
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOHOSTOS="linux"
Ubuntu 17.04
I'd like to make the func
assert
available in the testing standard library package. I see it being used in multiple places already and it makes sense to centralize it and DRY up the usage.Examples:
https://github.com/golang/go/blob/master/test/const.go#L39
https://github.com/golang/go/blob/master/test/iota.go#L11
https://github.com/golang/go/blob/master/test/typeswitch.go#L38
The text was updated successfully, but these errors were encountered: