Skip to content

Commit d1f0e5a

Browse files
Fix round-5 review: restore Execute params, fix StarAtStart assertion, guard length-mismatch for wildcards
- ConsoleAssert.cs: Execute() was missing 'string expectedOutput' and 'Action action' parameters (accidentally dropped during isWildcardMatching threading). Build was broken with CS1501 + two CS0103 errors. Restored both parameters. - ConsoleAssert.cs: Guard the length-mismatch message with !isWildcardMatching so that pattern-vs-output length comparisons are not shown for wildcard failures (misleading: pattern length is semantically unrelated to match success). - WildcardMatchAnalyzerTests.cs: AnalyzeMatch_StarAtStart_MatchesLeadingText expected 'long prefix ' (trailing space) but FindNextLiteralMatch anchors on ' end' so '*' captures 'long prefix' without the space. Corrected assertion.
1 parent 77f7c29 commit d1f0e5a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

IntelliTect.TestTools.Console.Tests/WildcardMatchAnalyzerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void AnalyzeMatch_StarAtStart_MatchesLeadingText()
183183
Assert.AreEqual(1, results.Count);
184184
Assert.IsTrue(results[0].IsMatch);
185185
Assert.AreEqual(1, results[0].WildcardMatches.Count);
186-
Assert.AreEqual("long prefix ", results[0].WildcardMatches[0].MatchedText);
186+
Assert.AreEqual("long prefix", results[0].WildcardMatches[0].MatchedText);
187187
}
188188

189189
[TestMethod]

IntelliTect.TestTools.Console/ConsoleAssert.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ private static string StripAnsiEscapeCodes(string input)
409409
/// <param name="equivalentOperatorErrorMessage">A textual description of the message if the <paramref name="areEquivalentOperator"/> returns false</param>
410410
/// <param name="isWildcardMatching">True when the comparison uses wildcard matching; enables the detailed wildcard diff in the failure message.</param>
411411
private static string Execute(string givenInput,
412+
string expectedOutput,
413+
Action action,
412414
Func<string, string, bool> areEquivalentOperator,
413415
NormalizeOptions normalizeOptions = NormalizeOptions.Default,
414416
string equivalentOperatorErrorMessage = "Values are not equal",
@@ -581,7 +583,7 @@ private static string GetMessageText(string expectedOutput, string output, strin
581583

582584
int expectedOutputLength = expectedOutput.Length;
583585
int outputLength = output.Length;
584-
if (expectedOutputLength != outputLength)
586+
if (expectedOutputLength != outputLength && !isWildcardMatching)
585587
{
586588
result += $"{Environment.NewLine}The expected length of {expectedOutputLength} does not match the output length of {outputLength}. ";
587589
string[] items = (new string[] { expectedOutput, output }).OrderBy(item => item.Length).ToArray();

0 commit comments

Comments
 (0)