When comparing a String with null the Differ fails with a NullPointerException.
Minimal repro:
import zio.Scope
import zio.test._
object StringDiffTest extends ZIOSpecDefault {
override def spec: ZSpec[TestEnvironment with Scope, Any] =
test("String diffing fails") {
assertTrue("" == null)
}
}
The reason is that DiffInstances#stringDiff tries to split the Strings at newlines, which won't work for null.
I know using null is not a best practice, but sometimes one doesn't have a choice when interacting with Java APIs...
I would propose adding a special case for null at the beginning of the diffing, but I'm open to other suggestions.