当前位置: 首页>>代码示例>>Golang>>正文


Golang C.Fatalf方法代码示例

本文整理汇总了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)
	}
}
开发者ID:nuin,项目名称:ampify,代码行数:7,代码来源:checkers_test.go

示例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)
	}
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例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)
	}
}
开发者ID:nuin,项目名称:ampify,代码行数:11,代码来源:helpers_test.go

示例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)
	}
}
开发者ID:nuin,项目名称:ampify,代码行数:11,代码来源:checkers_test.go

示例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)
	}
}
开发者ID:nuin,项目名称:ampify,代码行数:15,代码来源:checkers_test.go


注:本文中的gocheck.C.Fatalf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。