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
Revisit usage of diff with =~ in assertions #4862
Comments
If possible, I'd like to help with this issue. For that I'd need to know a bit more about what needs to be done. Any inputs @josevalim or @lexmag? |
@YAGoOaR this issue is about finding a way to improve difference highlighting when
will give: The output is the same as if we would use the
|
The problem with running the difference is that it runs it over the whole left string and that will always be misleading as we never want to compare the whole two full strings. You can see this in your snippet from the fact it is picking up letter by letter in the diff. One possible solution is to find the longest submatch and diff only that, but that's expensive in terms of implementation and time complexity. So right now I would propose 2. |
I actually quite like the difference it shows. It's caught some error messages where I was expecting one thing but got another that was off by only a single character (line number specifically), and it makes it obvious in those cases. |
@OvermindDL1 Are you saying that in particular to |
@lexmag are we consider the string distance before computing the diff for |
@OvermindDL1 and thank you for the useful example! :D |
@josevalim yes, my example is on the edge of acceptable threshold. |
Closing this for now. We do not have a good answer and it seems discarding the diff means we have more to lose than to gain. |
No description provided.
The text was updated successfully, but these errors were encountered: