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

chore: implement PartialEq for most Snafu Error enums #757

Merged
merged 6 commits into from
Mar 26, 2024

Conversation

NickLarsenNZ
Copy link
Member

@NickLarsenNZ NickLarsenNZ commented Mar 25, 2024

Description

This change is to encourage testing error variants by type rather than text contents.

  • Bump strum to 0.26.2
  • Derive PartialEq on most Snafu Error enums.
  • Add custom implementations of PartialEq for Snafu error enums that use types that are not directly comparable.

Important

Some variants are impossible to compare, so these implementations are restricted to #[cfg(test)] because they cause panics.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Reviewer

Preview Give feedback

Acceptance

Preview Give feedback

@NickLarsenNZ NickLarsenNZ changed the title Error partialeq chore: implement PartialEq for most Snafu Error enums Mar 25, 2024
@NickLarsenNZ NickLarsenNZ self-assigned this Mar 25, 2024
Copy link
Member

@Techassi Techassi left a comment

Choose a reason for hiding this comment

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

Looking good! Only requires a small change.

As already discussed, we might want to thrive to add more unit tests in the crates themself (where testing might be easier), instead of relying on external tests (in operators). It then might be possible to eliminate some of the manually implemented PartialEq implementations.

crates/stackable-certs/src/ca/mod.rs Outdated Show resolved Hide resolved
crates/stackable-certs/src/ca/mod.rs Show resolved Hide resolved
Co-authored-by: Techassi <[email protected]>
@NickLarsenNZ NickLarsenNZ requested a review from Techassi March 26, 2024 09:49
@NickLarsenNZ NickLarsenNZ enabled auto-merge March 26, 2024 10:09
@NickLarsenNZ NickLarsenNZ added this pull request to the merge queue Mar 26, 2024
Merged via the queue into main with commit 6c7ceb5 Mar 26, 2024
17 checks passed
@NickLarsenNZ NickLarsenNZ deleted the error-partialeq branch March 26, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants