learn_golang/idiomatic_go/ch5/README.md

398 B

Functions

Unit Tests

Ok from what I can tell a file for unit tests should end in _test.go matching the file name it is testing (covention?) Tests of functions should begin with TestFuncNameOrTestScenario(t *testing.T). The t *testing.T is pointer to a testing.T object which is a struct with that provides methods for writing unit tests.

Then you use go test to run the unit tests.