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


Golang C.Fatalf方法代码示例

本文整理汇总了Golang中github.com/pingcap/check.C.Fatalf方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Fatalf方法的具体用法?Golang C.Fatalf怎么用?Golang C.Fatalf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/pingcap/check.C的用法示例。


在下文中一共展示了C.Fatalf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestComment

func (s *CheckersS) TestComment(c *check.C) {
	bug := check.Commentf("a %d bc", 42)
	comment := bug.CheckCommentString()
	if comment != "a 42 bc" {
		c.Fatalf("Commentf returned %#v", comment)
	}
}
开发者ID:ninefive,项目名称:tidb,代码行数:7,代码来源:checkers_test.go

示例2: testHasKey

func testHasKey(c *check.C, expectedResult bool, expectedErr string, params ...interface{}) {
	actualResult, actualErr := check.HasKey.Check(params, nil)
	if actualResult != expectedResult || actualErr != expectedErr {
		c.Fatalf(
			"Check returned (%#v, %#v) rather than (%#v, %#v)",
			actualResult, actualErr, expectedResult, expectedErr)
	}
}
开发者ID:yzl11,项目名称:vessel,代码行数:8,代码来源:checkers2_test.go

示例3: testInfo

func testInfo(c *check.C, checker check.Checker, name string, paramNames []string) {
	info := checker.Info()
	if info.Name != name {
		c.Fatalf("Got name %s, expected %s", info.Name, name)
	}
	if !reflect.DeepEqual(info.Params, paramNames) {
		c.Fatalf("Got param names %#v, expected %#v", info.Params, paramNames)
	}
}
开发者ID:ninefive,项目名称:tidb,代码行数:9,代码来源:checkers_test.go

示例4: TestCheckSucceedWithoutExpected

func (s *HelpersS) TestCheckSucceedWithoutExpected(c *check.C) {
	checker := &MyChecker{result: true, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
	testHelperSuccess(c, "Check(1, checker)", true, func() interface{} {
		return c.Check(1, checker)
	})
	if !reflect.DeepEqual(checker.params, []interface{}{1}) {
		c.Fatalf("Bad params for check: %#v", checker.params)
	}
}
开发者ID:ninefive,项目名称:tidb,代码行数:9,代码来源:helpers_test.go

示例5: TestCheckSucceedWithExpected

func (s *HelpersS) TestCheckSucceedWithExpected(c *check.C) {
	checker := &MyChecker{result: true}
	testHelperSuccess(c, "Check(1, checker, 2)", true, func() interface{} {
		return c.Check(1, checker, 2)
	})
	if !reflect.DeepEqual(checker.params, []interface{}{1, 2}) {
		c.Fatalf("Bad params for check: %#v", checker.params)
	}
}
开发者ID:ninefive,项目名称:tidb,代码行数:9,代码来源:helpers_test.go

示例6: testCheck

func testCheck(c *check.C, checker check.Checker, result bool, error string, params ...interface{}) ([]interface{}, []string) {
	info := checker.Info()
	if len(params) != len(info.Params) {
		c.Fatalf("unexpected param count in test; expected %d got %d", len(info.Params), len(params))
	}
	names := append([]string{}, info.Params...)
	result_, error_ := checker.Check(params, names)
	if result_ != result || error_ != error {
		c.Fatalf("%s.Check(%#v) returned (%#v, %#v) rather than (%#v, %#v)",
			info.Name, params, result_, error_, result, error)
	}
	return params, names
}
开发者ID:ninefive,项目名称:tidb,代码行数:13,代码来源:checkers_test.go

示例7: TestFatalf

func (s *FoundationS) TestFatalf(c *check.C) {
	var line int
	defer (func() {
		if !c.Failed() {
			c.Error("Fatalf() didn't fail the test")
		} else {
			c.Succeed()
			expected := fmt.Sprintf("foundation_test.go:%d:\n"+
				"    c.Fatalf(\"Die %%s!\", \"now\")\n"+
				"... Error: Die now!\n\n",
				line)
			if c.GetTestLog() != expected {
				c.Error("Incorrect log:", c.GetTestLog())
			}
		}
	})()

	line = getMyLine() + 1
	c.Fatalf("Die %s!", "now")
	c.Log("Fatalf() didn't stop the test")
}
开发者ID:ninefive,项目名称:tidb,代码行数:21,代码来源:foundation_test.go


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