import ( . "gopkg.in/check.v1" ) func Test(t *testing.T) { TestingT(t) } type MySuite struct{} var _ = Suite(&MySuite{}) func (s *MySuite) TestSomeFunction(c *C) { result := someFunction() c.Assert(result, Equals, 42) }
c.Assert(someFunction(), Equals, 42)
go test ./...Tests are run using the `go test` command, followed by the path to the directory containing the test code. In this example, the tests for the current package and all sub-packages are run. The package library for go-check is `gopkg.in/check.v1`. This library provides the core functionality for defining test suites and running tests, as well as a set of built-in assertions.