Skip to content

Commit f6d519a

Browse files
committed
Add docs to SummaryReport.scala
1 parent ebd1670 commit f6d519a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

compiler/test/dotty/tools/vulpix/SummaryReport.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,38 @@ package vulpix
55
import scala.collection.mutable
66
import dotc.reporting.TestReporter
77

8+
/** `SummaryReporting` can be used by unit tests by utilizing `@AfterClass` to
9+
* call `echoSummary`
10+
*
11+
* This is used in vulpix by passing the companion object's `SummaryReporting`
12+
* to each test, the `@AfterClass def` then calls the `SummaryReport`'s
13+
* `echoSummary` method in order to dump the summary to both stdout and a log
14+
* file
15+
*/
816
trait SummaryReporting {
17+
/** Report a failed test */
918
def reportFailed(): Unit
19+
20+
/** Report a test as passing */
1021
def reportPassed(): Unit
22+
23+
/** Add the name of the failed test */
1124
def addFailedTest(msg: String): Unit
25+
26+
/** Add instructions to reproduce the error */
1227
def addReproduceInstruction(instr: String): Unit
28+
29+
/** Add a message that will be issued in the beginning of the summary */
1330
def addStartingMessage(msg: String): Unit
31+
32+
/** Add a cleanup hook to be run upon completion */
1433
def addCleanup(f: () => Unit): Unit
34+
35+
/** Echo the summary report to the appropriate locations */
1536
def echoSummary(): Unit
1637
}
1738

39+
/** A summary report that doesn't do anything */
1840
final class NoSummaryReport extends SummaryReporting {
1941
def reportFailed(): Unit = ()
2042
def reportPassed(): Unit = ()
@@ -25,6 +47,9 @@ final class NoSummaryReport extends SummaryReporting {
2547
def echoSummary(): Unit = ()
2648
}
2749

50+
/** A summary report that logs to both stdout and the `TestReporter.logWriter`
51+
* which outputs to a log file in `./testlogs/`
52+
*/
2853
final class SummaryReport extends SummaryReporting {
2954

3055
private val startingMessages = mutable.ArrayBuffer.empty[String]

0 commit comments

Comments
 (0)