Skip to content

Commit 9cfe76e

Browse files
Fix diff printing in CoverageTests
1 parent 79d9a6f commit 9cfe76e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

compiler/test/dotty/tools/dotc/coverage/CoverageTests.scala

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import scala.jdk.CollectionConverters.*
1515
import scala.util.Properties.userDir
1616
import scala.language.unsafeNulls
1717
import scala.collection.mutable.Buffer
18+
import dotty.tools.dotc.util.DiffUtil
1819

1920
@Category(Array(classOf[BootstrappedOnlyTests]))
2021
class CoverageTests:
@@ -56,12 +57,8 @@ class CoverageTests:
5657
val expected = fixWindowsPaths(Files.readAllLines(expectFile).asScala)
5758
val obtained = fixWindowsPaths(Files.readAllLines(targetFile).asScala)
5859
if expected != obtained then
59-
// 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)
60-
for ((exp, actual),i) <- expected.zip(obtained).filter(_ != _).zipWithIndex do
61-
Console.err.println(s"wrong line ${i+1}:")
62-
Console.err.println(s" expected: $exp")
63-
Console.err.println(s" actual : $actual")
64-
fail(s"$targetFile differs from expected $expectFile")
60+
val instructions = FileDiff.diffMessage(expectFile.toString, targetFile.toString)
61+
fail(s"Coverage report differs from expected data.\n$instructions")
6562

6663
})
6764

0 commit comments

Comments
 (0)