Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/reflection: Migrate reflection tests for struct tags to exported methods #790

Merged
merged 6 commits into from
Jul 6, 2023

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Jun 29, 2023

This PR will make it easier for us to verify internal refactoring that is made to any of the struct reflection logic. That includes:

  • Moving the existing Struct error tests into a single table-driven test (same as FromStruct)
  • Moving all the internal testing of getStructTags to use the exported Struct method
    • The only test that was removed was TestGetStructTags_notAStruct, as the exported methods (FromStruct & Struct) already have tests for this scenario and the logic in getStructTags is mostly defensive.
  • Added new tests to FromStruct for all the error scenarios from getStructTags + the success scenario with ignored tags

@austinvalle austinvalle requested a review from a team as a code owner June 29, 2023 16:50
@austinvalle austinvalle added the reflection Issues and PRs about the reflection subsystem used to convert between attr.Values and Go values. label Jun 29, 2023
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀

@bflad bflad added this to the v1.4.0 milestone Jul 3, 2023
@austinvalle austinvalle merged commit 51c5272 into main Jul 6, 2023
@austinvalle austinvalle deleted the av/struct-reflection branch July 6, 2023 13:02
@bflad bflad modified the milestones: v1.4.0, v1.3.3 Jul 20, 2023
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
reflection Issues and PRs about the reflection subsystem used to convert between attr.Values and Go values.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants