fix: pluralize item suffix in ComplyWith failure messages#951
Conversation
The ComplyWith constraints hardcoded ` items` (always plural), producing ungrammatical output like `for exactly one items`. Route the suffix through EnumerableQuantifier.GetItemString() like the other collection constraints, so singular quantifiers (Exactly(1), AtLeast(1), AtMost(1)) render `item` instead. Also adds verification tests for the Exactly(n).ComplyWith chain and the AtLeast(n).ComplyWith chain, which previously had no coverage.
There was a problem hiding this comment.
Pull request overview
Fixes ungrammatical ComplyWith failure messages (e.g., “for exactly one items”) by routing the item suffix through EnumerableQuantifier.GetItemString() so singular quantifiers render item instead of items.
Changes:
- Updated
ThatEnumerable.Elements.ComplyWithandThatAsyncEnumerable.Elements.ComplyWithexpectation formatting to useGetItemString()foritem/items. - Removed the now-unneeded
ComplyItemsconstant fromThatEnumerable. - Added new unit tests for
Exactly(n).ComplyWith(...)andAtLeast(n).ComplyWith(...)chains.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Tests/aweXpect.Tests/Collections/ThatEnumerable.Exactly.ComplyWith.Tests.cs | Adds coverage for Exactly(...).ComplyWith(...) and AtLeast(...).ComplyWith(...) scenarios (including a singular-message assertion for Exactly(1)). |
| Source/aweXpect/That/Collections/ThatEnumerable.Elements.ComplyWith.cs | Uses EnumerableQuantifier.GetItemString() instead of hardcoded " items" in expectation text. |
| Source/aweXpect/That/Collections/ThatEnumerable.cs | Removes the obsolete ComplyItems constant. |
| Source/aweXpect/That/Collections/ThatAsyncEnumerable.Elements.ComplyWith.cs | Aligns async ComplyWith expectation text with the singular/plural logic via GetItemString(). |
Test Results 23 files - 27 23 suites - 27 7m 49s ⏱️ -4s Results for commit 3f0d619. ± Comparison against base commit 16e2c24. This pull request removes 3166 and adds 3158 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
ComplyWith failure messages
|
🚀 Benchmark ResultsDetails
|
👽 Mutation ResultsaweXpectDetails
The final mutation score is 80.82%Coverage Thresholds: high:80 low:60 break:0aweXpect.CoreDetails
The final mutation score is NaN%Coverage Thresholds: high:80 low:60 break:0 |
…th` failure messages (#951) by Valentin Breuß
…th` failure messages (#951) by Valentin Breuß
|
This is addressed in release v2.34.0. |



The ComplyWith constraints hardcoded
items(always plural), producing ungrammatical output likefor exactly one items. Route the suffix through EnumerableQuantifier.GetItemString() like the other collection constraints, so singular quantifiers (Exactly(1), AtLeast(1), AtMost(1)) renderiteminstead.Also adds verification tests for the Exactly(n).ComplyWith chain and the AtLeast(n).ComplyWith chain, which previously had no coverage.