Update on assertion frameworks

Add clearer notes on assertion frameworks not being accepted 
into the codebase.

Ref: https://github.com/openfaas/certifier/pull/72
This commit is contained in:
Alex Ellis 2021-05-12 17:54:48 +01:00 committed by GitHub
parent 8ee050985c
commit b767995195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,6 +145,34 @@ If you would like to ammend your commit follow this guide: [Git: Rewriting Histo
Please follow style guide on [this blog post](https://blog.alexellis.io/golang-writing-unit-tests/) from [The Go Programming Language](https://www.amazon.co.uk/Programming-Language-Addison-Wesley-Professional-Computing/dp/0134190440)
Specifically, the style means using Golang code to evaluate whether a tested method produced the correct result, for instance:
```golang
func TestSum(t *testing.T) {
want := 10
got := Sum(5, 5)
if want != got {
t.Fatal("want: %d, but got: %d, want, got)
}
}
```
Making use of test tables, additional comparison libraries or helper functions is acceptable.
This kind of usage will not be merged into the codebase:
```golang
func TestSomething(t *testing.T) {
assert := assert.New(t)
// assert equality
assert.Equal(Sum(5, 5), 10, "they should be equal")
```
Please do not introduce .NET/Java-style assertion libararies such as [stretchr/testify](https://github.com/stretchr/testify).
**A note on go-routines**
If you are making changes to code that use goroutines, consider adding `goleak` to your test to help ensure that we are not leaking any goroutines. Simply add
```go