1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +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
func (a *Assert) IsNotNil(value any) {
if value == nil {
makeTestFailed(a.T, a.CaseName, "not nil", value)
func (a *Assert) IsNotNil(v any) {
if v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil()) {
makeTestFailed(a.T, a.CaseName, "not nil", v)
}
}