Detect when `toString` is the same but only newline characters differ
JakeWharton opened this issue · comments
This can be a common occurrence with code generation where you have platform-specific golden files or strings as your expects, but platform-agnostic code generation that uses either CRLF or LF depending on the host. Since these render the same visually and will be the same source type, there is no way to tell what's wrong from the error message.
Truth does this, and it's glorious.
The diff actually renders newline and tab characters, open to suggestions for improvements though
https://github.com/willowtreeapps/assertk/blob/main/assertk/src/commonMain/kotlin/assertk/assertions/support/support.kt#L159
https://github.com/willowtreeapps/assertk/blob/main/assertk/src/commonTest/kotlin/test/assertk/assertions/StringTest.kt#L48