arrays value types in a zero-initialized state are considered empty by adamluzsi · Pull Request #1126 · stretchr/testify

Summary

With this pull request, arrays value types in a zero-initialized state are considered empty.
Before that, only the zero-length arrays were considered empty.
The new behavior is backward compatible with the existing currently test coverage.

Changes

  • added test cases for assert.Empty with array value types.
  • added test cases for assert.NotEmpty with array value types.
  • Adjust implementation according to the new test cases
  • minor refactoring

Motivation

When I was reading the code source for learning purposes.
I discovered by chance that the assert.isEmpty / case reflect.Array code part doesn't have coverage.

assert.Empty(t, [1]int{})
assert.NotEmpty(t, [1]int{42})

Related issues

I'm not aware of any, but I didn't deeply check through the issues.