本文整理汇总了Golang中gocheck.C.Fatalf方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Fatalf方法的具体用法?Golang C.Fatalf怎么用?Golang C.Fatalf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gocheck.C
的用法示例。
在下文中一共展示了C.Fatalf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestBug
func (s *CheckersS) TestBug(c *gocheck.C) {
bug := gocheck.Bug("a %d bc", 42)
info := bug.GetBugInfo()
if info != "a 42 bc" {
c.Fatalf("Bug() returned %#v", info)
}
}
示例2: TestCheckSucceedWithoutExpected
func (s *HelpersS) TestCheckSucceedWithoutExpected(c *gocheck.C) {
checker := &MyChecker{noExpectedValue: true}
testHelperSuccess(c, "Check(1, checker)", true, func() interface{} {
return c.Check(1, checker)
})
if checker.obtained != 1 || checker.expected != nil {
c.Fatalf("Bad (obtained, expected) values for check (%d, %d)",
checker.obtained, checker.expected)
}
}
示例3: TestAssertSucceedWithExpected
func (s *HelpersS) TestAssertSucceedWithExpected(c *gocheck.C) {
checker := &MyChecker{}
testHelperSuccess(c, "Assert(1, checker, 2)", nil, func() interface{} {
c.Assert(1, checker, 2)
return nil
})
if checker.obtained != 1 || checker.expected != 2 {
c.Fatalf("Bad (obtained, expected) values for check (%d, %d)",
checker.obtained, checker.expected)
}
}
示例4: testCheck
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)
}
}
示例5: testInfo
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)
}
}