softwaremill / diffx

Pretty diffs for scala case classes
Apache License 2.0
345 stars 30 forks source link

Trailing whitespace is ignored #422

Closed kubukoz closed 1 year ago

kubukoz commented 1 year ago

Whitespace at the end of a string seems not to affect the diff result.

.show on such diffs also results in a comparison of seemingly equal strings.

Reproduction:

//> using lib "com.softwaremill.diffx::diffx-core:0.8.1"
import com.softwaremill.diffx.Diff

object demo extends App {
  println(Diff[String].apply("hello", "hello\n").isIdentical)
  println(Diff[String].apply("hello", "hello\n").show())
  println("after")
}

Prints:

true
hello
after