-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better reporting for string differences #6881
Comments
I think #4619 would have solved this, but @pedrottimark is busy with other things these days (in theory the different space character would've been highlighted). @thymikee @rickhanlonii thoughts on anything we can do as-is with |
We can do it on a matcher lever, similarly to how we do suggesting less strict matchers ( |
I think the best message would be something like:
|
Is there a module that allows us to detect all of these invisible characters? Or other characters that are difficult to tell by looking at it, like dash vs em dash vs dash, apostrophe vs single quote etc? For (CR)LF we could borrow these: https://github.com/concordancejs/concordance/blob/17203caddfb9013b614238da8a54ba6a3cf97944/lib/primitiveValues/string.js#L23-L32 @novemberborn have you given any more thought to this beyond the todo in the code I linked above? |
@SimenB not a heck of a lot, no. The basic idea would be to use control pictures where appropriate, and Would love to have a shareable library for this! |
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:
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 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 spacexA0
).Example
The text was updated successfully, but these errors were encountered: