Skip to content

Commit 23988da

Browse files
committed
Output to file and not show diff in terminal
1 parent f32d200 commit 23988da

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ compiler/test/debug/Gen.jar
7171
compiler/before-pickling.txt
7272
compiler/after-pickling.txt
7373
*.dotty-ide-version
74+
75+
*.decompiled.out

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

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -526,23 +526,26 @@ trait ParallelTesting extends RunnerOrchestration { self =>
526526
}.mkString("\n")
527527
.replaceFirst("@scala\\.annotation\\.internal\\.SourceFile\\([^\\)]+\\)( |\\n )", "") // FIXME: should not be printed in the decompiler
528528

529-
checkDiff(output, checkFile, testSource, 0) match {
530-
case Some(diff) =>
531-
println("Expected:")
532-
println(checkFile)
533-
println("Actual output;")
534-
println(output)
535-
println("Diff;")
536-
echo(diff)
537-
addFailureInstruction(diff)
538-
539-
// Print build instructions to file and summary:
540-
val buildInstr = testSource.buildInstructions(0, rep.warningCount)
541-
addFailureInstruction(buildInstr)
542-
543-
// Fail target:
544-
failTestSource(testSource)
545-
case None =>
529+
val check: String = Source.fromFile(checkFile).getLines().mkString("\n")
530+
531+
532+
if (output != check) {
533+
val outFile = dotty.tools.io.File(checkFile.toPath).addExtension(".out")
534+
outFile.writeAll(output)
535+
val msg =
536+
s"""Output differed for test $name, use the following command to see the diff:
537+
| > diff $checkFile $outFile
538+
""".stripMargin
539+
540+
echo(msg)
541+
addFailureInstruction(msg)
542+
543+
// Print build instructions to file and summary:
544+
val buildInstr = testSource.buildInstructions(0, rep.warningCount)
545+
addFailureInstruction(buildInstr)
546+
547+
// Fail target:
548+
failTestSource(testSource)
546549
}
547550
case _ =>
548551
}

tests/pos/simpleCaseObject.decompiled

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ package foo {
66
final module case class Foo() extends Object() with _root_.scala.Product {
77
this: foo.Foo.type =>
88

9-
override def hashCode(): Int =
10-
{
11-
var acc: Int = 329201766
12-
scala.runtime.Statics#finalizeHash(acc, 0)
13-
}
9+
override def hashCode(): Int = 1045991777
1410
override def toString(): String = "Foo"
1511
override def canEqual(that: Any): Boolean = that.isInstanceOf[foo.Foo]
1612
override def productArity: Int = 0

0 commit comments

Comments
 (0)