本文整理汇总了Golang中github.com/shaunduncan/gocheck.C.Fail方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Fail方法的具体用法?Golang C.Fail怎么用?Golang C.Fail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/shaunduncan/gocheck.C
的用法示例。
在下文中一共展示了C.Fail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestFailedAndSucceed
func (s *BootstrapS) TestFailedAndSucceed(c *gocheck.C) {
c.Fail()
c.Succeed()
if c.Failed() {
critical("c.Succeed() didn't put the test back in a non-failed state")
}
}
示例2: TestFailedAndFail
func (s *BootstrapS) TestFailedAndFail(c *gocheck.C) {
if c.Failed() {
critical("c.Failed() must be false first!")
}
c.Fail()
if !c.Failed() {
critical("c.Fail() didn't put the test in a failed state!")
}
c.Succeed()
}
示例3: TestSucceedNow
func (s *FoundationS) TestSucceedNow(c *gocheck.C) {
defer (func() {
if c.Failed() {
c.Error("SucceedNow() didn't succeed the test")
}
if c.GetTestLog() != "" {
c.Error("Something got logged:\n" + c.GetTestLog())
}
})()
c.Fail()
c.SucceedNow()
c.Log("SucceedNow() didn't stop the test")
}
示例4: TestErrorf
func (s *FoundationS) TestErrorf(c *gocheck.C) {
// Do not use checkState() here. It depends on Errorf() working.
expectedLog := fmt.Sprintf("foundation_test.go:%d:\n"+
" c.Errorf(\"Error %%v!\", \"message\")\n"+
"... Error: Error message!\n\n",
getMyLine()+1)
c.Errorf("Error %v!", "message")
failed := c.Failed()
c.Succeed()
if log := c.GetTestLog(); log != expectedLog {
c.Logf("Errorf() logged %#v rather than %#v", log, expectedLog)
c.Fail()
}
if !failed {
c.Logf("Errorf() didn't put the test in a failed state")
c.Fail()
}
}
示例5: TestLogAndFail
func (s *FailHelper) TestLogAndFail(c *gocheck.C) {
s.testLine = getMyLine() - 1
c.Log("Expected failure!")
c.Fail()
}