Skip to content

Commit

Permalink
调整
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Oct 16, 2023
1 parent 64d1189 commit b03f0f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/container_single_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestSingle(t *testing.T) {
assert.False(t, container.IsRegister[IDatabase]("oracle"))
assert.False(t, container.IsRegister[error]("oracle"))

mysqlAny := container.ResolveType(reflect.TypeOf((*IDatabase)(nil)))
mysqlAny, _ := container.ResolveType(reflect.TypeOf((*IDatabase)(nil)))
assert.NotNil(t, mysqlAny.(*mysql))

// 取一个不存在的别名的实例
Expand Down
18 changes: 9 additions & 9 deletions test/try_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ func TestTry(t *testing.T) {
assert.Panics(t, func() {
exception.ThrowWebExceptionf(502, "%d", 123)
})
}).CatchWebException(func(exp *exception.WebException) {
}).CatchWebException(func(exp exception.WebException) {
os.Exit(-1)
}).CatchRefuseException(func(exp *exception.RefuseException) {
}).CatchRefuseException(func(exp exception.RefuseException) {
os.Exit(-1)
}).CatchStringException(func(exp string) {
os.Exit(-1)
Expand All @@ -30,9 +30,9 @@ func TestTry(t *testing.T) {

exception.Try(func() {
exception.ThrowException("aaa")
}).CatchWebException(func(exp *exception.WebException) {
}).CatchWebException(func(exp exception.WebException) {
os.Exit(-1)
}).CatchRefuseException(func(exp *exception.RefuseException) {
}).CatchRefuseException(func(exp exception.RefuseException) {
os.Exit(-1)
}).CatchStringException(func(exp string) {
assert.Equal(t, "aaa", exp)
Expand All @@ -42,11 +42,11 @@ func TestTry(t *testing.T) {

exception.Try(func() {
exception.ThrowRefuseException("aaa")
}).CatchWebException(func(exp *exception.WebException) {
}).CatchWebException(func(exp exception.WebException) {
os.Exit(-1)
}).CatchStringException(func(exp string) {
os.Exit(-1)
}).CatchRefuseException(func(exp *exception.RefuseException) {
}).CatchRefuseException(func(exp exception.RefuseException) {
assert.Equal(t, "aaa", exp.Message)
}).CatchException(func(exp any) {
os.Exit(-1)
Expand All @@ -56,9 +56,9 @@ func TestTry(t *testing.T) {
exception.ThrowWebException(502, "aaa")
}).CatchStringException(func(exp string) {
os.Exit(-1)
}).CatchRefuseException(func(exp *exception.RefuseException) {
}).CatchRefuseException(func(exp exception.RefuseException) {
os.Exit(-1)
}).CatchWebException(func(exp *exception.WebException) {
}).CatchWebException(func(exp exception.WebException) {
assert.Equal(t, "aaa", exp.Message)
assert.Equal(t, 502, exp.StatusCode)
}).CatchException(func(exp any) {
Expand All @@ -68,7 +68,7 @@ func TestTry(t *testing.T) {
try := exception.Try(func() {
exception.ThrowRefuseException("aaa")
})
try.CatchRefuseException(func(exp *exception.RefuseException) {
try.CatchRefuseException(func(exp exception.RefuseException) {
panic("aaa")
})
try.CatchException(func(exp any) {
Expand Down

0 comments on commit b03f0f8

Please sign in to comment.