- Ending a file’s name with
_test.go
tells thego test
command that this file contains test functions. - Use function name like
TestSTH
, passt *testing.T
as parameter - Example:
package main
import "testing"
func TestAdd(t *testing.T) {
if add(1, 2) != 3 {
t.Fail()
}
}