Skip to content

Commit

Permalink
Fix diff printing in CoverageTests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheElectronWill committed Jul 11, 2022
1 parent 79d9a6f commit 9cfe76e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions compiler/test/dotty/tools/dotc/coverage/CoverageTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import scala.jdk.CollectionConverters.*
import scala.util.Properties.userDir
import scala.language.unsafeNulls
import scala.collection.mutable.Buffer
import dotty.tools.dotc.util.DiffUtil

@Category(Array(classOf[BootstrappedOnlyTests]))
class CoverageTests:
Expand Down Expand Up @@ -56,12 +57,8 @@ class CoverageTests:
val expected = fixWindowsPaths(Files.readAllLines(expectFile).asScala)
val obtained = fixWindowsPaths(Files.readAllLines(targetFile).asScala)
if expected != obtained then
// FIXME: zip will drop part of the output if one is shorter (i.e. will not print anything of one is a refix of the other)
for ((exp, actual),i) <- expected.zip(obtained).filter(_ != _).zipWithIndex do
Console.err.println(s"wrong line ${i+1}:")
Console.err.println(s" expected: $exp")
Console.err.println(s" actual : $actual")
fail(s"$targetFile differs from expected $expectFile")
val instructions = FileDiff.diffMessage(expectFile.toString, targetFile.toString)
fail(s"Coverage report differs from expected data.\n$instructions")

})

Expand Down

0 comments on commit 9cfe76e

Please sign in to comment.