Enhance ConsoleAssert.AssertExpectation with detailed wildcard diff output #70
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.
Overview
This PR implements enhanced wildcard diff output for
ConsoleAssert.AssertExpectation
to provide detailed character-by-character analysis when wildcard matching fails, making it much easier to debug test failures.Problem
Previously, when wildcard pattern matching failed, the output only showed basic expected vs actual strings:
This made it very difficult to identify where wildcards matched and where failures occurred, especially in multiline outputs like ping results.
Solution
Added an enhanced wildcard diff system that provides:
*
matchedExample Enhanced Output
Implementation
New Components
DiffOptions
enum: Controls diff behavior (Default
vsEnhancedWildcardDiff
)WildcardDiffAnalyzer
: Analyzes patterns and tracks wildcard matchesWildcardDiffFormatter
: Formats enhanced output with line-by-line detailsAPI Changes
Enhanced methods with new overloads that accept
DiffOptions
:Backward Compatibility
DiffOptions.EnhancedWildcardDiff
flagTesting
Added comprehensive test suite covering:
Fixes #69.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.