Tighten scope-test assertions to full-string match#8226
Conversation
Introduce the foundational types and helpers for structured multi-line assertion failure messages as described in RFC 012: - EvidenceLine: labeled line record struct for evidence blocks - EvidenceBlock: collection of labeled lines with automatic alignment - StructuredAssertionMessage: builder producing the new multi-line format (prefix + summary + user message + evidence block + call-site) - AssertionValueRenderer: renders values per RFC 012 rules (null, quoted strings with escape sequences, booleans, collections as JSON arrays) - AssertFailedException: add ExpectedText/ActualText public properties - Assert: add ReportAssertFailed/ThrowAssertFailed overloads accepting StructuredAssertionMessage No existing assertion methods are changed yet - this PR only introduces the infrastructure that subsequent PRs will use to migrate each assertion method to the new format.
# Conflicts: # src/TestFramework/TestFramework/Assertions/Assert.cs # src/TestFramework/TestFramework/Assertions/AssertionValueRenderer.cs # src/TestFramework/TestFramework/Assertions/EvidenceBlock.cs # src/TestFramework/TestFramework/Assertions/StructuredAssertionMessage.cs # test/UnitTests/TestFramework.UnitTests/Assertions/AssertFailedExceptionTests.cs # test/UnitTests/TestFramework.UnitTests/Assertions/AssertionValueRendererTests.cs # test/UnitTests/TestFramework.UnitTests/Assertions/EvidenceBlockTests.cs # test/UnitTests/TestFramework.UnitTests/Assertions/StructuredAssertionMessageTests.cs
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Tightens four test assertions in AssertTests.ScopeTests.cs from substring matches to full-string matches for the second inner exception's message, aligning them with the existing full-string assertions used for the first inner exception.
Changes:
- Replaces
Should().Contain("Assert.AreEqual failed.")withShould().Be(...)containing the complete expected message in four scope tests.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTests/TestFramework.UnitTests/Assertions/AssertTests.ScopeTests.cs | Tightens four assertions to full-string match for the AreEqual failure message. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Evangelink
left a comment
There was a problem hiding this comment.
Generated by Expert Code Review (on open) for issue #8226 · ● 2.6M
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Resolved in 0d9a41c by merging the latest |
Follow-up to RFC 012 (#7750, #8170, #8187).
Tightens the four
Assert.AreEqual(1, 2)assertions inAssertTests.ScopeTests.csfromShould().Contain("Assert.AreEqual failed.")toShould().Be("Assert.AreEqual failed. Expected:<1>. Actual:<2>. 'expected' expression: '1', 'actual' expression: '2'.")for full-string match.The scope tests already used full-string
.Be(...)for the first inner exception; this brings the second inner exception (theAreEqualfailure) to the same standard so the format is fully pinned down by the test.No production-code changes. Build is clean (0 warnings, 0 errors).