mirror of
https://github.com/duke-git/lancet.git
synced 2026-03-01 00:35:28 +08:00
fix: fix bug of IsNil function
This commit is contained in:
@@ -79,10 +79,12 @@ func (a *Assert) LessOrEqual(expected, actual any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsNil check if value is nil
|
// IsNil check if value is nil
|
||||||
func (a *Assert) IsNil(value any) {
|
func (a *Assert) IsNil(v any) {
|
||||||
if value != nil {
|
if v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil()) {
|
||||||
makeTestFailed(a.T, a.CaseName, nil, value)
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makeTestFailed(a.T, a.CaseName, nil, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsNotNil check if value is not nil
|
// IsNotNil check if value is not nil
|
||||||
|
|||||||
Reference in New Issue
Block a user