Skip to content

Commit

Permalink
Partest can --show-diff again after incremental report.
Browse files Browse the repository at this point in the history
A flag is set in NestUI to look for "diff" in the transcript
of failing tests.
  • Loading branch information
som-snytt committed May 3, 2013
1 parent 4a627e7 commit c31e44f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/partest/scala/tools/partest/nest/ConsoleRunner.scala
Expand Up @@ -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)
Expand Down
13 changes: 12 additions & 1 deletion src/partest/scala/tools/partest/nest/NestUI.scala
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -186,6 +194,9 @@ object NestUI {
def setTerse() {
_terse = true
}
def setDiffOnFail() {
_diff = true
}
def verbose(msg: String) {
if (isVerbose)
System.err.println(msg)
Expand Down

0 comments on commit c31e44f

Please sign in to comment.