feat: chaining the extraction of multiple properties of the same subject#88
Merged
haraldmaida merged 27 commits intoApr 26, 2026
Conversation
… multiple fields on same subject for assertion
…ields-of-same-subject # Conflicts: # src/prelude.rs
…` - it should be called only once at the root `Spec`
…expecting` as trait `Expecting` BREAKING-CHANGE: the behavior of the trait method `Expecting::expecting` is exactly the same as the original methods `Spec::expecting` and `DerivedSpec::expecting`. The only change in custom code is that maybe the trait has to be imported in scope. The `Expecting` trait is included in the prelude. If the import `use asserting::prelude::` is used, there is no change needed.
… `DerivedSpec::extracting_ref` methods
…ields-of-same-subject
…xtracting` and `mapping` methods
…ted_elements_ref`
…rom Spec into trait `Satisfies` and implement it for `Spec` and `DerivedSpec`
…ields-of-same-subject # Conflicts: # src/iterator/mod.rs
…ement` into the trait `AssertElements`
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
==========================================
- Coverage 92.85% 87.95% -4.91%
==========================================
Files 41 42 +1
Lines 5756 6649 +893
Branches 5756 6649 +893
==========================================
+ Hits 5345 5848 +503
- Misses 345 731 +386
- Partials 66 70 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For asserting custom structs it should be possible to chain the extraction of multiple properties from the same subject for individual assertions.
For example:
As this requires, ,that the type of the extracted property implements
ToOwned(orClone), the new methodextracting_refis added (instead of re-purposing the existing methodextracting).