stretchr/testify

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

Aperta

#570 aperta il 7 mar 2018

 (4 commenti) (0 reazioni) (0 assegnatari)Go (1704 fork)batch import
help wanted

Metriche repository

Star
 (25.958 stelle)
Metriche merge PR
 (Merge medio 6g 15h) (2 PR mergiate in 30 g)

Descrizione

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".

Guida contributor