Skip to content

feat: explain why a block does not match in AsBlock() failures - #1829

Merged
vbreuss merged 4 commits into
mainfrom
feat/as-block-failure-messages
Oct 15, 2026
Merged

vbreuss merged 4 commits into
mainfrom
feat/as-block-failure-messages

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 15, 2026

Copy link
Copy Markdown
Member

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.

@vbreuss vbreuss self-assigned this Oct 15, 2026
@vbreuss
vbreuss force-pushed the feat/as-block-failure-messages branch from 77220af to f450db5 Compare October 15, 2026 03:44
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    14 files   -      77      14 suites   - 77   7m 0s ⏱️ - 2h 53m 5s
 5 474 tests  -  32 169   5 474 ✅  -  32 169  0 💤 ±0  0 ❌ ±0 
37 014 runs   - 181 532  37 014 ✅  - 181 532  0 💤 ±0  0 ❌ ±0 

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.

	
	    get;
	"a": 1
	await
	{
	}, 1)


, 2)

b, 2, False)
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(27ac6773-3fab-446f-8663-afd5b0511334)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(425d67f3-ae86-4b0c-aa2c-8a7895e67acb)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(6e2b1bbc-2ac9-45fc-a581-9920bd39bb02)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(88f0f8f5-f665-4d98-8225-270954c60417)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(b645a627-b85f-44b4-ad1c-f4151e7530cf)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(b9231abf-806c-402d-a728-154ad091b317)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(d7fbbfc2-1e6d-41b8-8591-6dccb0f8a117)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(1dc6ca7b-a1f6-4471-8ddc-eea1172b394b)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(34e4c88d-e4d1-43d4-a5e3-8bf6c4193924)
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(3c4be75b-bc91-4cd8-a2ac-fb93849cd1f8)
…

♻️ This comment has been updated with latest results.

vbreuss and others added 3 commits October 15, 2026 15:44
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
vbreuss force-pushed the feat/as-block-failure-messages branch from 1fcabe6 to 1108cf6 Compare October 15, 2026 13:44
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss merged commit 335ce22 into main Oct 15, 2026
15 checks passed
@vbreuss
vbreuss deleted the feat/as-block-failure-messages branch October 15, 2026 14:23
@github-actions

Copy link
Copy Markdown
Contributor

This is addressed in release v3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant