Skip to content

Fix --show-diff for partest issue #609 #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion test/dotty/partest/DPConsoleRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down