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


Golang gocheck.C类代码示例

本文整理汇总了Golang中gocheck.C的典型用法代码示例。如果您正苦于以下问题:Golang C类的具体用法?Golang C怎么用?Golang C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TestAssertNotEqualArraySucceeding

func (s *HelpersS) TestAssertNotEqualArraySucceeding(c *gocheck.C) {
	testHelperSuccess(c, "AssertNotEqual([]byte, []byte)", nil,
		func() interface{} {
			c.AssertNotEqual([]byte{1, 2}, []byte{1, 3})
			return nil
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:7,代码来源:helpers_test.go

示例2: 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

示例3: TestCheckNotEqualFailing

func (s *HelpersS) TestCheckNotEqualFailing(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckNotEqual\\(obtained, unexpected\\):\n" +
		"\\.+ Both \\(int\\): 10\n\n"
	testHelperFailure(c, "CheckNotEqual(10, 10)", false, false, log,
		func() interface{} {
			return c.CheckNotEqual(10, 10)
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:9,代码来源:helpers_test.go

示例4: TestCheckNotEqualArrayFailing

func (s *HelpersS) TestCheckNotEqualArrayFailing(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckNotEqual\\(obtained, unexpected\\):\n" +
		"\\.+ Both \\(\\[\\]uint8\\): \\[\\]byte{0x1, 0x2}\n\n"
	testHelperFailure(c, "CheckNotEqual([]byte{2}, []byte{3})", false, false,
		log, func() interface{} {
			return c.CheckNotEqual([]byte{1, 2}, []byte{1, 2})
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:9,代码来源:helpers_test.go

示例5: TestCheckWithNilChecker

func (s *HelpersS) TestCheckWithNilChecker(c *gocheck.C) {
	log := "helpers_test\\.go:[0-9]+ > helpers_test\\.go:[0-9]+:\n" +
		"\\.+ Check\\(obtained, nil!\\?, \\.\\.\\.\\):\n" +
		"\\.+ Oops\\.\\. you've provided a nil checker!\n\n"
	testHelperFailure(c, "Check(obtained, nil)", false, false, log,
		func() interface{} {
			return c.Check(1, nil)
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:9,代码来源:helpers_test.go

示例6: TestCheckFailWithoutExpected

func (s *HelpersS) TestCheckFailWithoutExpected(c *gocheck.C) {
	checker := &MyChecker{failCheck: true, noExpectedValue: true}
	log := "helpers_test\\.go:[0-9]+ > helpers_test\\.go:[0-9]+:\n" +
		"\\.+ Check\\(myobtained, MyChecker\\):\n" +
		"\\.+ Myobtained \\(int\\): 1\n\n"
	testHelperFailure(c, "Check(1, checker)", false, false, log,
		func() interface{} {
			return c.Check(1, checker)
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例7: TestCheckEqualFailingWithNil

func (s *HelpersS) TestCheckEqualFailingWithNil(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckEqual\\(obtained, expected\\):\n" +
		"\\.+ Obtained \\(int\\): 10\n" +
		"\\.+ Expected \\(nil\\): nil\n\n"
	testHelperFailure(c, "CheckEqual(10, nil)", false, false, log,
		func() interface{} {
			return c.CheckEqual(10, nil)
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例8: 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

示例9: TestAssertWithNilChecker

func (s *HelpersS) TestAssertWithNilChecker(c *gocheck.C) {
	log := "helpers_test\\.go:[0-9]+ > helpers_test\\.go:[0-9]+:\n" +
		"\\.+ Assert\\(obtained, nil!\\?, \\.\\.\\.\\):\n" +
		"\\.+ Oops\\.\\. you've provided a nil checker!\n\n"
	testHelperFailure(c, "Assert(obtained, nil)", nil, true, log,
		func() interface{} {
			c.Assert(1, nil)
			return nil
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例10: TestAssertNotEqualFailing

func (s *HelpersS) TestAssertNotEqualFailing(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ AssertNotEqual\\(obtained, unexpected\\):\n" +
		"\\.+ Both \\(int\\): 10\n\n"
	testHelperFailure(c, "AssertNotEqual(10, 10)", nil, true, log,
		func() interface{} {
			c.AssertNotEqual(10, 10)
			return nil
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例11: TestAssertNotEqualArrayFailing

func (s *HelpersS) TestAssertNotEqualArrayFailing(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ AssertNotEqual\\(obtained, unexpected\\):\n" +
		"\\.+ Both \\(\\[\\]uint8\\): \\[\\]byte{0x1, 0x2}\n\n"
	testHelperFailure(c, "AssertNotEqual([]byte{2}, []byte{3})", nil, true,
		log, func() interface{} {
			c.AssertNotEqual([]byte{1, 2}, []byte{1, 2})
			return nil
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例12: TestCheckMatchFailing

func (s *HelpersS) TestCheckMatchFailing(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckMatch\\(value, expression\\):\n" +
		"\\.+ Value \\(string\\): \"foo\"\n" +
		"\\.+ Expected to match expression: \"bar\"\n\n"
	testHelperFailure(c, "CheckMatch('foo', 'bar')", false, false, log,
		func() interface{} {
			return c.CheckMatch("foo", "bar")
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例13: TestCheckNotEqualWithBugInfo

func (s *HelpersS) TestCheckNotEqualWithBugInfo(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckNotEqual\\(obtained, unexpected\\):\n" +
		"\\.+ Both \\(int\\): 10\n" +
		"\\.+ That's clearly WRONG!\n\n"
	testHelperFailure(c, "CheckNotEqual(10, 10, issue)", false, false, log,
		func() interface{} {
			return c.CheckNotEqual(10, 10, "That's clearly ", "WRONG!")
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:10,代码来源:helpers_test.go

示例14: 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

示例15: TestValueLoggingWithArrays

func (s *HelpersS) TestValueLoggingWithArrays(c *gocheck.C) {
	checker := &MyChecker{failCheck: true}
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ Check\\(myobtained, MyChecker, myexpected\\):\n" +
		"\\.+ Myobtained \\(\\[\\]uint8\\): \\[\\]byte{0x1, 0x2}\n" +
		"\\.+ Myexpected \\(\\[\\]uint8\\): \\[\\]byte{0x1, 0x3}\n\n"
	testHelperFailure(c, "Check([]byte{1}, chk, []byte{3})", false, false, log,
		func() interface{} {
			return c.Check([]byte{1, 2}, checker, []byte{1, 3})
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:11,代码来源:helpers_test.go


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