func TestMyFunction(c *C) { result := myFunction() c.Assert(result, Equals, 42) }
func TestPanic(c *C) { c.Assert(func() { myFunction(nil) }, Panics, "Invalid input") }Here, we use the `Assert` method with the `Panics` checker to ensure that `myFunction` panics with the message "Invalid input" when given a `nil` argument. The gopkg.in.check.v1 package is a testing library for Go.