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


Golang ensure.PanicDeepEqual函数代码示例

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


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


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