// These tests verify the inner workings of the helper methods associated // with gocheck.T. package gocheck_test import ( "gocheck" "os" ) var helpersS = gocheck.Suite(&HelpersS{}) type HelpersS struct{} func (s *HelpersS) TestCountSuite(c *gocheck.C) { suitesRun += 1 } // ----------------------------------------------------------------------- // Fake checker and bug info to verify the behavior of Assert() and Check(). type MyChecker struct { checkError string failCheck, noExpectedValue bool obtained, expected interface{} } func (checker *MyChecker) Name() string { return "MyChecker" }
package gocheck_test import ( "gocheck" "os" ) type CheckersS struct{} var _ = gocheck.Suite(&CheckersS{}) func testInfo(c *gocheck.C, checker gocheck.Checker, name, obtainedVarName, expectedVarName string) { if checker.Name() != name { c.Fatalf("Got name %s, expected %s", checker.Name(), name) } obtainedName, expectedName := checker.VarNames() if obtainedName != obtainedVarName { c.Fatalf("Got obtained label %#v, expected %#v", obtainedName, obtainedVarName) } if expectedName != expectedVarName { c.Fatalf("Got expected label %#v, expected %#v", expectedName, expectedVarName) } } func testCheck(c *gocheck.C, checker gocheck.Checker, obtained, expected interface{}, wantedResult bool, wantedError string) { result, error := checker.Check(obtained, expected)