Fix util_test.go

This commit is contained in:
Sasha Koshka 2025-01-30 19:59:25 -05:00
parent 641624ef3b
commit bfca8c6f4a

View File

@ -17,17 +17,17 @@ func TestDefaul(test *testing.T) {
}
func TestPanicWrap(test *testing.T) {
err := panicWrap(func (ctx context.Context) error {
err := panicWrap(func () error {
return errors.New("test case 0")
})
test.Log(err)
if err.Error() != "test case 0" { test.Fatal("not equal") }
err = panicWrap(func (ctx context.Context) error {
err = panicWrap(func () error {
panic(errors.New("test case 1"))
})
test.Log(err)
if err.Error() != "test case 1" { test.Fatal("not equal") }
err = panicWrap( func (ctx context.Context) error {
err = panicWrap( func () error {
return nil
})
test.Log(err)
@ -35,17 +35,17 @@ func TestPanicWrap(test *testing.T) {
}
func TestPanicWrapCtx(test *testing.T) {
err := panicWrap(context.Background(), func (ctx context.Context) error {
err := panicWrapCtx(context.Background(), func (ctx context.Context) error {
return errors.New("test case 0")
})
test.Log(err)
if err.Error() != "test case 0" { test.Fatal("not equal") }
err = panicWrap(context.Background(), func (ctx context.Context) error {
err = panicWrapCtx(context.Background(), func (ctx context.Context) error {
panic(errors.New("test case 1"))
})
test.Log(err)
if err.Error() != "test case 1" { test.Fatal("not equal") }
err = panicWrap(context.Background(), func (ctx context.Context) error {
err = panicWrapCtx(context.Background(), func (ctx context.Context) error {
return nil
})
test.Log(err)