stretchr / testify

A toolkit with common assertions and mocks that plays nicely with the standard library
MIT License
23.15k stars 1.59k forks source link

assert: improve unsafe.Pointer tests #1505

Closed dolmen closed 8 months ago

dolmen commented 11 months ago

Summary

  1. Add infrastructure to split tests that use unsafe from other tests.
  2. Improve testing of package assert with unsafe.Pointer values.

Changes

  1. Isolate tests that use the "unsafe" package in a separate package ./assert/internal/unsafetests. That way the assert package is not tainted with unsafe.
  2. Remove one reference to the private assert.isNil() in assert tests.
  3. Add more tests of assert.Nil and assert.NotNil with unsafe.Pointer.

Motivation

assert/assertions_test.go is tainted with unsafe just because of a single test added in #1319.