當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.Fail方法代碼示例

本文整理匯總了Golang中github.com/dvln/check.C.Fail方法的典型用法代碼示例。如果您正苦於以下問題:Golang C.Fail方法的具體用法?Golang C.Fail怎麽用?Golang C.Fail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/dvln/check.C的用法示例。


在下文中一共展示了C.Fail方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestFailedAndSucceed

func (s *BootstrapS) TestFailedAndSucceed(c *check.C) {
	c.Fail()
	c.Succeed()
	if c.Failed() {
		critical("c.Succeed() didn't put the test back in a non-failed state")
	}
}
開發者ID:dvln,項目名稱:check,代碼行數:7,代碼來源:bootstrap_test.go

示例2: TestFailedAndFail

func (s *BootstrapS) TestFailedAndFail(c *check.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()
}
開發者ID:dvln,項目名稱:check,代碼行數:10,代碼來源:bootstrap_test.go

示例3: TestSucceedNow

func (s *FoundationS) TestSucceedNow(c *check.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")
}
開發者ID:dvln,項目名稱:check,代碼行數:14,代碼來源:foundation_test.go

示例4: TestErrorf

func (s *FoundationS) TestErrorf(c *check.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()
	}
}
開發者ID:dvln,項目名稱:check,代碼行數:18,代碼來源:foundation_test.go

示例5: TestLogAndFail

func (s *FailHelper) TestLogAndFail(c *check.C) {
	s.testLine = getMyLine() - 1
	c.Log("Expected failure!")
	c.Fail()
}
開發者ID:dvln,項目名稱:check,代碼行數:5,代碼來源:check_test.go


注:本文中的github.com/dvln/check.C.Fail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。