-
Notifications
You must be signed in to change notification settings - Fork 88
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
String expectation messages alter content #299
Comments
Open to suggestions, would be worth seeing how other assertion libs handle this. |
In IntelliJ it makes things difficult because it doesn't work nicely with the inbuilt assertion diff feature. |
Hm, I'd rather not introduce a configuration for this. However I do think there's room for improvement with the error message. A couple of ideas would be to 1: move the diff to it's own lines so that the original contents are included and it's easier to scan, and 2: change the diff symbol so something that's less likely to be used in the contents. Something like:
Downside of this is intellij's assertion diff feature is extremely picky and won't show in this case. It does show if the additional diff is above instead of below, but I don't think that reads very well. Thoughts? |
There is a related issue in opentest4j. I guess diff should eventually be solved there. If it's solved at the opentest4j level then it'll eventually make it in to JUnit5, which in turn will be eventually be supported by all the major IDEs. |
Hello all, Sorry about vanishing, but some mails are going to my gmail social folder. I need to update those filters. @evant Might I ask why don't you want to introduce another configuration? @BrynCooke Even if it is fixed on opentest4j, the core issue will still be present, since the assertion text will introduce extra characters. |
The reason I don't want to introduce a configuration is that I don't think it adequately solves the problem. The way I see it, there's two issues here:
Also, not aware of any other assertion lib out there that lets you configure this. |
I don't think there is a good answer at the moment. This requires some sort of fix outside of the assertk codebase. So probably just leave things as they are for now. |
This is not a critical issue because it should not happen that often. Although I think that compatibility with Intellij should be an afterthought. After all, most of the time I look at those messages is through a command line. Feel free to close the issue if you think it should be addressed at another level. |
These "[]" really bother me. I think it is the job of the IDE to highlight the differences. Which works really well with JUnit and IntelliJ IDEA. Therefore I prefer to keep the expected/actual value as they are. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
On expectation fail, the library issues a message displaying what went wrong.
If the expectation is a String object it will wrap the differences in angle brackets
[ ]
. This is a cool feature that highlights where the problem is but changes the content of the expectation and the actual value.The issue is worse if the values already contain angle brackets by themselves, making it harder to spot where the problem is. Bellow is the output of a failing test.
I've checked the custom fail messages, but it seems a different use case.
It would be nice to allow disabling this highlight feature.
Thanks
The text was updated successfully, but these errors were encountered: