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

Adapt EqualExportedValues to accept ptr types on top of struct types #1547

Closed redachl closed 7 months ago

redachl commented 7 months ago

Disclaimer: This is my first pull request on an open-source project.

Summary

This PR adapts the EqualExportedValues method to also handle pointer types, on top of struct types.

Changes

The function copyExportedFields already handles pointer types correctly. Therefore it is only necessary to make the validation include pointer types. The added tests pass, which validates this hypothesis.

Motivation

It is useful for proto message equality. Using Equal often fails because unexported values of proto messages are different.

Related issues

Closes #758

redachl commented 7 months ago

Actually there's another PR doing this: #1517