stretchr/testify

assert: NotNil accepts non-nillable types and doesn't fail

Open

#570 opened on Mar 7, 2018

 (4 comments) (0 reactions) (0 assignees)Go (1,704 forks)batch import
help wanted

Repository metrics

Stars
 (25,958 stars)
PR merge metrics
 (PR metrics pending)

Description

https://github.com/stretchr/testify/blob/b89eecf5ca5db6d3ba60b237ffe3df7bafb7662f/assert/assertions.go#L390-L410

isNil will always return false, so NotNil will always return true for int, string, struct, etc.

I would expect it to error with "invalid type".

Contributor guide