- Testes devem:
- ficar num arquivo cuja terminação seja _test.go
- ficar na mesma package que o código a ser testado
- ficar em funções com nome "func TestNome(*testing.T)"
- Para rodar os testes:
- go test
- go test -v
- Para falhas, utilizamos t.Error(), onde a maneira idiomática é algo do tipo "expected: x. got: y."
- Código: https://github.com/ellenkorbes/aprendago/tree/master/c%C3%B3digo/27_testes-e-benchmarking/01_introducao
Continue this lesson in the app
Install CourseHive on Android or iOS to keep learning while you move.