import ( . "launchpad.net/gocheck" "testing" ) func Test(t *testing.T) { TestingT(t) } type MySuite struct{} var _ = Suite(&MySuite{}) func (s *MySuite) TestMyFunction(c *C) { result := MyFunction("hello") c.Check(result, Equals, "HELLO") }
func (s *MySuite) TestMyFunctionFatal(c *C) { c.Assert(func() { MyFunction("") }, Panics) }In this example, we're testing that calling `MyFunction` with an empty string argument will result in a fatal error. We use the `c.Assert()` function to assert that calling `MyFunction("")` will panic. If it doesn't, the test will fail.