aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2015-05-27 23:23:26 +0200
committerDmitry Petrashko <dark@d-d.me>2015-05-27 23:23:26 +0200
commitc0b693060c666f66cc5f26462e95f74b68975f31 (patch)
tree536a802b2211afb03c70325f5695660b2002b38a
parent3940818a996264f67b6ea05c6b6141d8a36b6a92 (diff)
parentb9c3f9624bd74c4f8bd5856ddbf86ccc52f21546 (diff)
downloaddotty-c0b693060c666f66cc5f26462e95f74b68975f31.tar.gz
dotty-c0b693060c666f66cc5f26462e95f74b68975f31.tar.bz2
dotty-c0b693060c666f66cc5f26462e95f74b68975f31.zip
Merge pull request #612 from vsalvis/vsalvis-fix-showdiff
Fix --show-diff for partest issue #609
-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) {