diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-04-12 11:20:36 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-04-12 11:49:11 +0200 |
commit | f6d519ab713cac49c6228f142cc4ccfc8880ef10 (patch) | |
tree | fa5d9fd6b11fe9284ccff9c841a95598dc8e43d2 /compiler/test/dotty/tools | |
parent | ebd16700937d2e522f99ac5dd046217d889e8cb4 (diff) | |
download | dotty-f6d519ab713cac49c6228f142cc4ccfc8880ef10.tar.gz dotty-f6d519ab713cac49c6228f142cc4ccfc8880ef10.tar.bz2 dotty-f6d519ab713cac49c6228f142cc4ccfc8880ef10.zip |
Add docs to SummaryReport.scala
Diffstat (limited to 'compiler/test/dotty/tools')
-rw-r--r-- | compiler/test/dotty/tools/vulpix/SummaryReport.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/vulpix/SummaryReport.scala b/compiler/test/dotty/tools/vulpix/SummaryReport.scala index 53b0942ce..8f3047f49 100644 --- a/compiler/test/dotty/tools/vulpix/SummaryReport.scala +++ b/compiler/test/dotty/tools/vulpix/SummaryReport.scala @@ -5,16 +5,38 @@ package vulpix import scala.collection.mutable import dotc.reporting.TestReporter +/** `SummaryReporting` can be used by unit tests by utilizing `@AfterClass` to + * call `echoSummary` + * + * This is used in vulpix by passing the companion object's `SummaryReporting` + * to each test, the `@AfterClass def` then calls the `SummaryReport`'s + * `echoSummary` method in order to dump the summary to both stdout and a log + * file + */ trait SummaryReporting { + /** Report a failed test */ def reportFailed(): Unit + + /** Report a test as passing */ def reportPassed(): Unit + + /** Add the name of the failed test */ def addFailedTest(msg: String): Unit + + /** Add instructions to reproduce the error */ def addReproduceInstruction(instr: String): Unit + + /** Add a message that will be issued in the beginning of the summary */ def addStartingMessage(msg: String): Unit + + /** Add a cleanup hook to be run upon completion */ def addCleanup(f: () => Unit): Unit + + /** Echo the summary report to the appropriate locations */ def echoSummary(): Unit } +/** A summary report that doesn't do anything */ final class NoSummaryReport extends SummaryReporting { def reportFailed(): Unit = () def reportPassed(): Unit = () @@ -25,6 +47,9 @@ final class NoSummaryReport extends SummaryReporting { def echoSummary(): Unit = () } +/** A summary report that logs to both stdout and the `TestReporter.logWriter` + * which outputs to a log file in `./testlogs/` + */ final class SummaryReport extends SummaryReporting { private val startingMessages = mutable.ArrayBuffer.empty[String] |