mirror of https://github.com/stretchr/testify.git
fix: fix bug for check unsafe.Pointer isNil (#1319)
parent
1333b5d3bd
commit
9acc22213e
|
@ -530,7 +530,7 @@ func isNil(object interface{}) bool {
|
|||
[]reflect.Kind{
|
||||
reflect.Chan, reflect.Func,
|
||||
reflect.Interface, reflect.Map,
|
||||
reflect.Ptr, reflect.Slice},
|
||||
reflect.Ptr, reflect.Slice, reflect.UnsafePointer},
|
||||
kind)
|
||||
|
||||
if isNilableKind && value.IsNil() {
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -2558,3 +2559,10 @@ func TestErrorAs(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsNil(t *testing.T) {
|
||||
var n unsafe.Pointer = nil
|
||||
if !isNil(n) {
|
||||
t.Fatal("fail")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue