Example #1
0
func testCheck(c *gocheck.C, checker gocheck.Checker,
	obtained, expected interface{},
	wantedResult bool, wantedError string) {
	result, error := checker.Check(obtained, expected)
	if result != wantedResult || error != wantedError {
		c.Fatalf("%s.Check(%#v, %#v) returned "+
			"(%#v, %#v) rather than (%#v, %#v)",
			checker.Name(), obtained, expected,
			result, error, wantedResult, wantedError)
	}
}
Example #2
0
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)
	}
}