Repository navigation
feat: explain why a block does not match in AsBlock() failures - #1829
Merged
Merged
Conversation
vbreuss
force-pushed
the
feat/as-block-failure-messages
branch
from
October 15, 2026 03:44
77220af to
f450db5
Compare
Contributor
Test Results 14 files - 77 14 suites - 77 7m 0s ⏱️ - 2h 53m 5s Results for commit 631e55c. ± Comparison against base commit 126a8c8. This pull request removes 32523 and adds 281 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
A failing `AsBlock()` only repeated the subject, so the line that broke the block had to be found by hand. `IsEqualTo(...).AsBlock()` now names the first line that does not match (with the usual difference, its indentation, or a non-blank line where a blank one is expected), else the different number of lines. `Contains(...).AsBlock()` names the lines of the occurrences it found, and without an occurrence the closest match: one that only differs in its indentation, the block found only inside of lines, or the window with the most matching lines, as long as at most 100000 lines have to be compared. The build scope is set to `CoreOnly`, because aweXpect calls the new `StringEqualityOptions.GetOccurrenceDetails` of aweXpect.Core.
…) failures A subject with fewer lines than the block is compared with it from its first line on, the text of the block is searched inside of lines even when the subject is too long to compare every window, and a positive count without an occurrence no longer returns an incomplete text. The helpers to count line feeds and to recognize the comparison of a comparer are shared with StringDifference, so that a culture-aware comparer also finds the block inside of lines.
vbreuss
force-pushed
the
feat/as-block-failure-messages
branch
from
October 15, 2026 13:44
1fcabe6 to
1108cf6
Compare
|
Contributor
|
This is addressed in release v3.2.0. |
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.



A failing
AsBlock()only repeated the subject, so the line that broke the block had to be found by hand.IsEqualTo(...).AsBlock()now names the first line that does not match (with the usual difference, its indentation, or a non-blank line where a blank one is expected), else the different number of lines.Contains(...).AsBlock()names the lines of the occurrences it found, and without an occurrence the closest match: one that only differs in its indentation, the block found only inside of lines, or the window with the most matching lines, as long as at most 100000 lines have to be compared.The build scope is set to
CoreOnly, because aweXpect calls the newStringEqualityOptions.GetOccurrenceDetailsof aweXpect.Core.