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

Golang ensure.PanicDeepEqual函数代码示例

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

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



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

示例1: TestClosePoolSizeUndefined

func TestClosePoolSizeUndefined(t *testing.T) {
	t.Parallel()
	defer ensure.PanicDeepEqual(t, "no close pool size configured")
	(&Pool{
		Max:         1,
		IdleTimeout: time.Second,
	}).Acquire()
}
开发者ID:intercom,项目名称:dvara,代码行数:8,代码来源:rpool_test.go


示例2: TestRunNoArgsWithArg

func TestRunNoArgsWithArg(t *testing.T) {
	t.Parallel()
	h := newHarness(t)
	defer h.Stop()
	h.env.Exit = func(i int) { panic(exitCode(i)) }
	func() {
		defer ensure.PanicDeepEqual(t, exitCode(1))
		r := runNoArgs(h.env, nil)
		r(noOpCmd(), []string{"foo"})
	}()
	ensure.StringContains(t, h.Err.String(), "unexpected arguments")
}
开发者ID:hassanabidpk,项目名称:parse-cli,代码行数:12,代码来源:main_test.go


示例3: TestRunNoArgsFuncError

func TestRunNoArgsFuncError(t *testing.T) {
	t.Parallel()
	const message = "hello world"
	h := newHarness(t)
	defer h.Stop()
	h.env.Exit = func(i int) { panic(exitCode(i)) }
	func() {
		defer ensure.PanicDeepEqual(t, exitCode(1))
		r := runNoArgs(h.env, func(*env) error { return errors.New(message) })
		r(noOpCmd(), nil)
	}()
	ensure.StringContains(t, h.Err.String(), message)
}
开发者ID:hassanabidpk,项目名称:parse-cli,代码行数:13,代码来源:main_test.go


示例4: TestPanicDeepEqualFailure

func TestPanicDeepEqualFailure(t *testing.T) {
	var c capture
	func() {
		defer ensure.PanicDeepEqual(&c, 1)
		panic(2)
	}()
	c.Contains(t, `TestPanicDeepEqualFailure
expected these to be equal:
ACTUAL:
(int) 2

EXPECTED:
(int) 1`)
}
开发者ID:fwessels,项目名称:minio-xl,代码行数:14,代码来源:ensure_test.go


示例5: TestRunWithAppNotFound

func TestRunWithAppNotFound(t *testing.T) {
	t.Parallel()
	h := newHarness(t)
	defer h.Stop()
	c := legacyConfig{Applications: map[string]*parseAppConfig{"a": {}}}
	h.makeWithConfig(jsonStr(t, c))
	h.env.Exit = func(i int) { panic(exitCode(i)) }
	func() {
		defer ensure.PanicDeepEqual(t, exitCode(1))
		r := runWithClient(h.env, nil)
		r(noOpCmd(), []string{"b"})
	}()
	ensure.StringContains(t, h.Err.String(), `App "b" wasn't found`)
}
开发者ID:hassanabidpk,项目名称:parse-cli,代码行数:14,代码来源:main_test.go


示例6: TestPanicDeepEqualFailure

func TestPanicDeepEqualFailure(t *testing.T) {
	var c capture
	func() {
		defer ensure.PanicDeepEqual(&c, 1)
		panic(2)
	}()
	c.Matches(t, `TestPanicDeepEqualFailure((.func1)?)
expected these to be equal:
ACTUAL:
\(int\) 2

EXPECTED:
\(int\) 1`)
}
开发者ID:thomasf,项目名称:alkasir,代码行数:14,代码来源:ensure_test.go


示例7: TestDiscardInvalid

func TestDiscardInvalid(t *testing.T) {
	t.Parallel()
	defer ensure.PanicDeepEqual(t, errWrongPool)
	var cm resourceMaker
	p := Pool{
		New:           cm.New,
		Max:           1,
		MinIdle:       1,
		IdleTimeout:   time.Hour,
		ClosePoolSize: 1,
	}
	r, err := cm.New()
	ensure.Nil(t, err)
	p.Discard(r)
}
开发者ID:intercom,项目名称:dvara,代码行数:15,代码来源:rpool_test.go


示例8: TestRunWithAppMultipleArgs

func TestRunWithAppMultipleArgs(t *testing.T) {
	t.Parallel()
	h := newHarness(t)
	defer h.Stop()
	h.env.Exit = func(i int) { panic(exitCode(i)) }
	func() {
		defer ensure.PanicDeepEqual(t, exitCode(1))
		r := runWithClient(h.env, nil)
		r(noOpCmd(), []string{"foo", "bar"})
	}()
	ensure.StringContains(
		t,
		h.Err.String(),
		"only an optional app name is expected",
	)
}
开发者ID:hassanabidpk,项目名称:parse-cli,代码行数:16,代码来源:main_test.go


示例9: TestRunWithAppNonProjectDir

func TestRunWithAppNonProjectDir(t *testing.T) {
	t.Parallel()
	h := newHarness(t)
	defer h.Stop()
	h.makeEmptyRoot()
	h.env.Exit = func(i int) { panic(exitCode(i)) }
	func() {
		defer ensure.PanicDeepEqual(t, exitCode(1))
		r := runWithClient(h.env, nil)
		r(noOpCmd(), nil)
	}()
	ensure.StringContains(
		t,
		h.Err.String(),
		"Command must be run inside a Parse project.",
	)
}
开发者ID:hassanabidpk,项目名称:parse-cli,代码行数:17,代码来源:main_test.go


示例10: TestRunWithAppError

func TestRunWithAppError(t *testing.T) {
	t.Parallel()
	h := newHarness(t)
	defer h.Stop()
	const appName = "a"
	c := &parseConfig{
		Applications: map[string]*parseAppConfig{
			appName: {ApplicationID: "id", MasterKey: "token"},
		},
	}
	h.makeWithConfig(jsonStr(t, c))
	h.env.Exit = func(i int) { panic(exitCode(i)) }
	const message = "hello world"
	func() {
		defer ensure.PanicDeepEqual(t, exitCode(1))
		r := runWithClient(h.env, func(e *env, c *context) error {
			ensure.NotNil(t, c)
			return errors.New(message)
		})
		r(noOpCmd(), []string{"a"})
	}()
	ensure.StringContains(t, h.Err.String(), message)
}
开发者ID:hassanabidpk,项目名称:parse-cli,代码行数:23,代码来源:main_test.go


示例11: TestSentinelCloserPanic

func TestSentinelCloserPanic(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "should never get called")
	sentinelCloser(0).Close()
}
开发者ID:intercom,项目名称:dvara,代码行数:4,代码来源:rpool_test_internals.go


示例12: TestIdleTimeoutUndefined

func TestIdleTimeoutUndefined(t *testing.T) {
	t.Parallel()
	defer ensure.PanicDeepEqual(t, "no idle timeout configured")
	(&Pool{Max: 1}).Acquire()
}
开发者ID:intercom,项目名称:dvara,代码行数:5,代码来源:rpool_test.go


示例13: TestPanicDeepEqualSuccess

func TestPanicDeepEqualSuccess(t *testing.T) {
	defer ensure.PanicDeepEqual(t, 1)
	panic(1)
}
开发者ID:thomasf,项目名称:alkasir,代码行数:4,代码来源:ensure_test.go


示例14: TestPanicDeepEqualNil

func TestPanicDeepEqualNil(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "can't pass nil to ensure.PanicDeepEqual")
	ensure.PanicDeepEqual(t, nil)
}
开发者ID:thomasf,项目名称:alkasir,代码行数:4,代码来源:ensure_test.go


示例15: TestAddMoreThanLimit

func TestAddMoreThanLimit(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "delta greater than limit")
	limitgroup.NewLimitGroup(1).Add(2)
}
开发者ID:postfix,项目名称:limitgroup,代码行数:4,代码来源:limitgroup_test.go


示例16: TestAddNegativeMoreThanExpected

func TestAddNegativeMoreThanExpected(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "trying to return more slots than acquired")
	limitgroup.NewLimitGroup(1).Add(-1)
}
开发者ID:postfix,项目名称:limitgroup,代码行数:4,代码来源:limitgroup_test.go


示例17: TestDoneMoreThanPossible

func TestDoneMoreThanPossible(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "trying to return more slots than acquired")
	limitgroup.NewLimitGroup(1).Done()
}
开发者ID:postfix,项目名称:limitgroup,代码行数:4,代码来源:limitgroup_test.go


示例18: TestZeroLimit

func TestZeroLimit(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "zero is not a valid limit")
	limitgroup.NewLimitGroup(0)
}
开发者ID:postfix,项目名称:limitgroup,代码行数:4,代码来源:limitgroup_test.go


示例19: TestInvalidNilError

func TestInvalidNilError(t *testing.T) {
	defer ensure.PanicDeepEqual(t, "error must not be nil")
	(&errgroup.Group{}).Error(nil)
}
开发者ID:postfix,项目名称:errgroup,代码行数:4,代码来源:errgroup_test.go


示例20: TestMaxUndefined

func TestMaxUndefined(t *testing.T) {
	t.Parallel()
	defer ensure.PanicDeepEqual(t, "no max configured")
	(&Pool{}).Acquire()
}
开发者ID:intercom,项目名称:dvara,代码行数:5,代码来源:rpool_test.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang ensure.SameElements函数代码示例发布时间:2022-05-23
下一篇:
Golang ensure.NotNil函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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