Better reporting for string differences
See original GitHub issue🚀 Feature Proposal
When using toEqual
to compare strings (or other iterable structures), when there is a difference between the strings, indicate where the first difference occurred and/or give additional details about the difference.
Motivation
While testing the output of a currency formatting function, I was bamboozled by the following output:
As it turns out, the spaces in the strings are different (breaking x20
vs non-breaking space xA0
).
Example
Expected value to equal:
"1 234,57 $"
Received:
"1 234,57 $"
First difference occurred at index 1 : " " does not equal " "
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Compare String Values | ReportsNow DAS User Guide
To compare two string values, add the String Compare calculation: Using the CTRL key, select two Column Headers. Right-click either column header and...
Read more >3 Ways to Compare Strings in C++ - DigitalOcean
In this article, you will learn methods to compare strings in C++. Strings in C++ can be compared using one of the following...
Read more >Approximate String Comparison and its Effect - Washington
is 2 percent. The results generally show that the different string comparators improve matching efficacy. In all of the best situations, error levels...
Read more >Compare two strings value in rdl file - Stack Overflow
Please help. NPServedasperPolicy and NPServed parameter values are coming from reports values. public function getNoticePeriodStatus (byval ...
Read more >Approximate String Comparison and its Effect on an Advanced ...
This paper describes string comparators and their effect in a production matching system. Because many lists have typographical errors in more ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Although the pull request highlights the changed substrings, they still look the same.
A possible future improvement is heuristic to display other invisible characters in addition to:
@SimenB not a heck of a lot, no. The basic idea would be to use control pictures where appropriate, and
\u
sequences for everything else. That may be annoying with dashes though.Would love to have a shareable library for this!