From c31e44fc4e532446136c6900fa645f549d15b409 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 2 May 2013 23:56:38 -0700 Subject: [PATCH] Partest can --show-diff again after incremental report. A flag is set in NestUI to look for "diff" in the transcript of failing tests. --- .../scala/tools/partest/nest/ConsoleRunner.scala | 1 + src/partest/scala/tools/partest/nest/NestUI.scala | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index e5ace20062be..5717aabb6a11 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -95,6 +95,7 @@ class ConsoleRunner extends DirectRunner { if (parsed isSet "--debug") NestUI.setDebug() if (parsed isSet "--verbose") NestUI.setVerbose() if (parsed isSet "--terse") NestUI.setTerse() + if (parsed isSet "--show-diff") NestUI.setDiffOnFail() // Early return on no args, version, or invalid args if (parsed isSet "--version") return echo(versionMsg) diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala index 87ffb0fed2cc..564270e531c9 100644 --- a/src/partest/scala/tools/partest/nest/NestUI.scala +++ b/src/partest/scala/tools/partest/nest/NestUI.scala @@ -84,7 +84,13 @@ object NestUI { dotCount += 1 } } - else echo(statusLine(state)) + else { + echo(statusLine(state)) + if (!state.isOk && isDiffy) { + val differ = bold(red("% ")) + "diff " + state.transcript find (_ startsWith differ) foreach (echo(_)) + } + } } def echo(message: String): Unit = synchronized { @@ -172,10 +178,12 @@ object NestUI { var _verbose = false var _debug = false var _terse = false + var _diff = false def isVerbose = _verbose def isDebug = _debug def isTerse = _terse + def isDiffy = _diff def setVerbose() { _verbose = true @@ -186,6 +194,9 @@ object NestUI { def setTerse() { _terse = true } + def setDiffOnFail() { + _diff = true + } def verbose(msg: String) { if (isVerbose) System.err.println(msg)