1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-15 10:12:29 +08:00

fix: fix bug of IsNotNil function

This commit is contained in:
dudaodong
2023-03-16 19:15:36 +08:00
parent a714e04470
commit 3f6aef1432

View File

@@ -88,9 +88,9 @@ func (a *Assert) IsNil(v any) {
} }
// IsNotNil check if value is not nil // IsNotNil check if value is not nil
func (a *Assert) IsNotNil(value any) { func (a *Assert) IsNotNil(v any) {
if value == nil { if v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil()) {
makeTestFailed(a.T, a.CaseName, "not nil", value) makeTestFailed(a.T, a.CaseName, "not nil", v)
} }
} }