aboutsummaryrefslogtreecommitdiff
path: root/test/dotty
diff options
context:
space:
mode:
authorvsalvis <salvisbergvera@gmail.com>2015-05-27 15:02:44 +0200
committervsalvis <salvisbergvera@gmail.com>2015-05-27 22:12:22 +0200
commitb9c3f9624bd74c4f8bd5856ddbf86ccc52f21546 (patch)
treed091111d199c739f71e5aa7c31d969cc64c3064e /test/dotty
parent2bfbb8ecd20954841069efda4950d833fb3bfcee (diff)
downloaddotty-b9c3f9624bd74c4f8bd5856ddbf86ccc52f21546.tar.gz
dotty-b9c3f9624bd74c4f8bd5856ddbf86ccc52f21546.tar.bz2
dotty-b9c3f9624bd74c4f8bd5856ddbf86ccc52f21546.zip
Fix --show-diff for partest
Diffstat (limited to 'test/dotty')
-rw-r--r--test/dotty/partest/DPConsoleRunner.scala21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/dotty/partest/DPConsoleRunner.scala b/test/dotty/partest/DPConsoleRunner.scala
index 788abe0e1..13ffed050 100644
--- a/test/dotty/partest/DPConsoleRunner.scala
+++ b/test/dotty/partest/DPConsoleRunner.scala
@@ -113,11 +113,30 @@ extends SuiteRunner(testSourcePath, fileManager, updateCheck, failed, javaCmdPat
} catch {
case t: Throwable => throw new RuntimeException(s"Error running $testFile", t)
}
- NestUI.reportTest(state)
+ reportTest(state)
runner.cleanup()
onFinishTest(testFile, state)
}
+
+ // override NestUI.reportTest because --show-diff doesn't work. The diff used
+ // seems to add each line to transcript separately, whereas NestUI assumes
+ // that the diff string was added as one entry in the transcript
+ def reportTest(state: TestState) = {
+ import NestUI._
+ import NestUI.color._
+
+ if (isTerse && state.isOk) {
+ NestUI.reportTest(state)
+ } else {
+ echo(statusLine(state))
+ if (!state.isOk && isDiffy) {
+ val differ = bold(red("% ")) + "diff "
+ state.transcript.dropWhile(s => !(s startsWith differ)) foreach (echo(_))
+ // state.transcript find (_ startsWith differ) foreach (echo(_)) // original
+ }
+ }
+ }
}
class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runner(testFile, suiteRunner) {