func TestSomething(t *testing.T) { c := check.C result := doSomething() c.Assert(result, check.Equals, expected) if result == unexpected { c.Fatal("Unexpected result!") } }
func TestDatabaseConnection(t *testing.T) { c := check.C db, err := connectToDatabase() c.Assert(err, check.IsNil) defer db.Close() if !db.Ping() { c.Fatal("Unable to ping database!") } }In this example, we have a test function that connects to a database and checks if it can ping the database. If the ping fails, we use c.Fatal to report the failure and halt the test immediately. Overall, the go-check.check package library provides a powerful set of tools for writing tests in Go, including the C.Fatal function which can be used to report test failures and halt execution immediately.