Skip to content

Commit 4e88857

Browse files
committed
Show git diff command on checkfile failure
This diff is more familiar and consistent across systems. We can assume that all developers of Dotty have git installed. When a checkfile fails we now show ```diff Test output dumped in: tests/run/xyz.check.out - See diff of the checkfile (`brew install icdiff` for colored diff) - > diff tests/run/xyz.check tests/run/xyz.check.out + See diff of the checkfile (`--color=always` for colored diff) + > git diff --no-index --color=always -- tests/run/xyz.check tests/run/xyz.check.out Replace checkfile with current output > mv tests/run/xyz.check.out tests/run/xyz.check ```
1 parent eae8831 commit 4e88857

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/test/dotty/tools/vulpix/FileDiff.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import java.nio.charset.StandardCharsets
1212

1313

1414
object FileDiff {
15+
def diffCommand(expectFile: String, actualFile: String): String =
16+
s"git diff --no-index --color=always -- $expectFile $actualFile"
17+
1518
def diffMessage(expectFile: String, actualFile: String): String =
1619
s"""Test output dumped in: $actualFile
17-
| See diff of the checkfile (`brew install icdiff` for colored diff)
18-
| > diff $expectFile $actualFile
20+
| See diff of the checkfile (`--color=always` for colored diff)
21+
| > ${FileDiff.diffCommand(expectFile, actualFile)}
1922
| Replace checkfile with current output
2023
| > mv $actualFile $expectFile
2124
""".stripMargin

0 commit comments

Comments
 (0)