Improve error message when comparing strings
Open
Nobody has claimed this yet.
is:enhancement
- Dominant language
- C#
- Stars
- 2.6k
- Forks
- 766
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 24
Description
[Test]
public void Test()
{
Assert.AreEqual(" ", "\u00A0"); // space and no breaking space
}
Results in:
String lengths are both 1. Strings differ at index 0.
Expected: " "
But was: " "
-----------^
Which looks confusing as they look the same.
Preferable would be:
String lengths are both 1. Strings differ at index 0.
Expected: " "
But was: "\u00A0"
-----------^
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the NUnit string-comparison failure formatting used by the Assert.AreEqual example. Reproduce the space versus non-breaking-space case, then add coverage for the expected escaped output and verify that the failure message distinguishes the characters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100