Skip to content

chore: implement PartialEq for most Snafu Error enums#757

Merged
NickLarsenNZ merged 6 commits intomainfrom
error-partialeq
Mar 26, 2024
Merged

chore: implement PartialEq for most Snafu Error enums#757
NickLarsenNZ merged 6 commits intomainfrom
error-partialeq

Conversation

@NickLarsenNZ
Copy link
Copy Markdown
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
- [ ] Code contains useful comments
- [ ] (Integration-)Test cases added
- [ ] Documentation added or updated
- [ ] Changelog updated
- [ ] Cargo.toml only contains references to git tags (not specific commits or branches)
# Acceptance
- [ ] Feature Tracker has been updated
- [ ] Proper release label has been added

@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
Copy Markdown
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.

Co-authored-by: Techassi <git@techassi.dev>
@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
@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