• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang gocheck.C类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestAssertFailWithoutExpected

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


示例17: TestAssertNotEqualWithMessage

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


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


示例19: TestAssertMatchFailingWithPureStrMatch

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


示例20: TestCheckWithTooManyExpected

func (s *HelpersS) TestCheckWithTooManyExpected(c *gocheck.C) {
	checker := &MyChecker{noExpectedValue: true}
	log := "helpers_test\\.go:[0-9]+ > helpers_test\\.go:[0-9]+:\n" +
		"\\.+ Check\\(myobtained, MyChecker, >myexpected<\\):\n" +
		"\\.+ Wrong number of myexpected args for MyChecker: " +
		"want 0, got 1\n\n"
	testHelperFailure(c, "Check(1, checker, !?)", false, false, log,
		func() interface{} {
			return c.Check(1, checker, 1)
		})
}
开发者ID:nuin,项目名称:ampify,代码行数:11,代码来源:helpers_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang cl.CLCreateContext函数代码示例发布时间:2022-05-28
下一篇:
Golang gobottest.Refute函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap