-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Array diffing behaviour questionable #415
Comments
Hmm, definitely sounds like a regression happened, as it used to be ok, please do work up a spec illustrating this example :) (if you could attach it to this issue using hub etc that'd be cool) |
Here are some entertaining examples of the symptoms of this problem. The only specs that test This has a little bit to do with this change and also with the fact that we are checking to see if there are any multiline strings in the flattened expected/actual, before coercing them to strings instead of after. |
This is very old, but still present - I'm guessing it's not obvious anything is wrong here, since both behaviors are actually reasonable (you still get a useful failure message without the diff in the 'wrong' case. But the problematic logic is here. It looks almost intentional, but I suspect we just need another branch here, for the 'if no multiline-strings present' case. At a glance, just removing the I think what we probably want is for the diff to not be displayed if the strings we would diff only have one line each, right? I can gin that up fairly readily, I just want to make sure it'll be the right thing. |
Ah, I misunderstood our current behavior slightly - if there are 'multiline strings' in the array, we make them one-line strings, and then print the diff; otherwise we don't print a diff at all. I can see why that would bother someone :-) So what we probably want is to skip the diff in the case that we get one-line strings for our two arguments, but keep it if we have anything else. |
Okay, I think I have a solution over here (in rspec-support) |
Currently, if you have an example like
expect(array1).to eq(array2)
a diff of the arrays will only show if both arrays once flattened contain only strings, and at least one of those strings contains a newline.The behaviour got this way through reasonable looking changes that did nice things, but this case doesn't make much sense any more.
I'm going to work on making this do something a little more expected (and figuring out how this got exactly the way it is) tonight. If anyone has any feedback on what exactly the desired behaviour is, or has any other info that would be helpful, please let me know.
👽 The truth is out there. 🚀
The text was updated successfully, but these errors were encountered: