fix: enhance error messages for collection element expectations#953
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the collection-element ComplyWith expectations to enrich failure output with additional diagnostic contexts (notably the evaluated collection and, for some quantifiers, matching/non-matching item lists), and updates the corresponding tests to assert the new message shapes.
Changes:
- Add
Collectioncontext toComplyWithfailures for sync/async enumerable element quantifiers. - Add quantifier-dependent contexts (
Not matching items/Matching items) to improve failure diagnostics forAll-style quantifiers. - Update unit tests and internal tests to match the revised failure messages (including
AsPrefix()where the message now has additional suffix contexts).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/aweXpect.Tests/Collections/ThatEnumerable.Exactly.ComplyWith.Tests.cs | Updates expected failure messages to include Collection: context. |
| Tests/aweXpect.Tests/Collections/ThatEnumerable.AtLeast.ComplyWith.Tests.cs | Updates expected failure message to include Collection: context. |
| Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs | Updates expected failure messages to include Not matching items: and Collection: contexts (including incomplete markers). |
| Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.ImmutableTests.cs | Mirrors new Not matching items: + Collection: contexts for immutable collection scenarios. |
| Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.EnumerableTests.cs | Mirrors new contexts for enumerable scenarios and truncation/incompleteness cases. |
| Tests/aweXpect.Tests/Collections/ThatAsyncEnumerable.All.Tests.cs | Switches some message assertions to prefix matching (AsPrefix()) due to additional appended contexts; adjusts one count-based message. |
| Tests/aweXpect.Tests/Collections/ThatAsyncEnumerable.All.ComplyWith.Tests.cs | Updates async comply-with failure expectations to include Not matching items: and Collection: contexts. |
| Tests/aweXpect.Internal.Tests/ThatTests/Collections/QuantifiableCollectionItems.AreEquivalentTests.cs | Updates internal expectations for comply-with+equivalency to the new context-driven message shape. |
| Source/aweXpect/That/Collections/ThatEnumerable.Elements.ComplyWith.cs | Implements the new contexts (Collection, matching/non-matching) for sync enumerable ComplyWith constraints. |
| Source/aweXpect/That/Collections/ThatAsyncEnumerable.Elements.ComplyWith.cs | Implements the new contexts (Collection, matching/non-matching) for async enumerable ComplyWith constraints. |
Test Results 23 files - 27 23 suites - 27 7m 21s ⏱️ -44s Results for commit 5d7b86e. ± Comparison against base commit 9e78cad. This pull request removes 3180 and adds 3158 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
🚀 Benchmark ResultsDetails
|
👽 Mutation ResultsaweXpectDetails
The final mutation score is 69.64%Coverage Thresholds: high:80 low:60 break:0aweXpect.CoreDetails
The final mutation score is NaN%Coverage Thresholds: high:80 low:60 break:0 |
ca91469 to
5d7b86e
Compare
|
…ion element expectations (#953) by Valentin Breuß
…ion element expectations (#953) by Valentin Breuß
|
This is addressed in release v2.34.0. |


This PR updates the collection-element
ComplyWithexpectations to enrich failure output with additional diagnostic contexts (notably the evaluated collection and, for some quantifiers, matching/non-matching item lists), and updates the corresponding tests to assert the new message shapes.Changes:
Collectioncontext toComplyWithfailures for sync/async enumerable element quantifiers.Not matching items/Matching items) to improve failure diagnostics forAll-style quantifiers.AsPrefix()where the message now has additional suffix contexts).