MarkusAmshove / Kluent

Fluent Assertion-Library for Kotlin
https://markusamshove.github.io/Kluent/
MIT License
867 stars 64 forks source link

Support diffs in Intellij #200

Closed JeffWright closed 3 years ago

JeffWright commented 3 years ago

It appears this was already raised once: https://github.com/MarkusAmshove/Kluent/issues/177

However subsequently this commit (I believe) broke the behavior by no longer allowing JUnit to provide the assertion behavior: https://github.com/MarkusAmshove/Kluent/commit/00ae45258c483abc28f5f7106756c45eaeb44b7e

The new format used by Kluent's assertEquals (that is, "Expected <$expected>, actual <$actual>.") is not picked up by IntelliJ to provide the useful "show difference"

I have tried adding a dependency on kotlin-test-junit as suggested in #177 to no avail.

MarkusAmshove commented 3 years ago

I have noticed the same and did a fix on the no-junit branch (which aims to remove JUnit as hard dependency in favor of kotlin.test), but still have a problem with assertSoftly which takes all exceptions and prints their messages.

IntelliJ's diff view is breaking in that case :) I didn't have the time to look further into it yet

drcolombo commented 3 years ago

@JeffWright and @MarkusAmshove please check my changes related to this issue and let me know if it's gone on your side. I've realized that the way how the comparison window shows the "differences" may depend on the platform, so if someone of you do development on Linux (unfortunately SSD with Ubuntu died recently...) or MacOS, your input will be really useful.

MarkusAmshove commented 3 years ago

I've released v1.68 which contains the changes from your PR.

I've also added some assertions (esp. equality ones) which should now show the compare window while not breaking when using assertSoftly

JeffWright commented 3 years ago

I can confirm that 1.68 fixes this issue. Thank you!