You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve failure message for string assertions when checking for equality (fluentassertions#2307)
* Draft improved failure message when checking for equality.
* Use line and column for multiline strings
* Fix failing tests
* Fix Qodana issues
* Fix further failing tests
* Also fix tests on MacOS (due to different newline)
* Calculate expected index
* Fix paranthesis
* Move specific methods from common StringExtensions to the `StringEqualityStrategy` class
* Fix review comments from @dennisdoomen and add tests for word boundary algorithm
* Improve tests by using [raw string literals](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/#raw-string-literals)
* Update releases.md
* Implement review comments from @jnyrup
* Adapt due to survived mutants
* Adapt test names
---------
Co-authored-by: Valentin Breuß <[email protected]>
/// Appends the <paramref name="prefix"/>, the escaped visible <paramref name="text"/> phrase decorated with ellipsis and the <paramref name="suffix"/> to the <paramref name="stringBuilder"/>.
150
+
/// </summary>
151
+
/// <remarks>When text phrase starts at <paramref name="indexOfStartingPhrase"/> and with a calculated length omits text on start or end, an ellipsis is added.</remarks>
ExpectationDescription+"{0}{reason}, but {1} differs near "+subject.IndexedSegmentAt(indexOfMismatch)+".",
72
-
expected,subject);
172
+
stringBuilder.Append(ellipsis);
73
173
}
174
+
175
+
stringBuilder.AppendLine(suffix);
74
176
}
75
177
76
-
publicstringExpectationDescription
178
+
/// <summary>
179
+
/// Calculates the start index of the visible segment from <paramref name="value"/> when highlighting the difference at <paramref name="indexOfFirstMismatch"/>.
180
+
/// </summary>
181
+
/// <remarks>
182
+
/// Either keep the last 10 characters before <paramref name="indexOfFirstMismatch"/> or a word begin (separated by whitespace) between 15 and 5 characters before <paramref name="indexOfFirstMismatch"/>.
0 commit comments