@@ -11,23 +11,25 @@ import (
1111 "github.com/logrusorgru/aurora"
1212)
1313
14- // OutputWriter represents the output
15- type OutputWriter struct {
14+ var _ Output = (* CLIOutputWriter )(nil )
15+
16+ // CLIOutputWriter represents the output
17+ type CLIOutputWriter struct {
1618 out io.Writer
1719 au aurora.Aurora
1820 template cliTemplate
1921}
2022
21- // NewCliOutput creates a new OutputWriter with a stdout writer
22- func NewCliOutput (color bool ) OutputWriter {
23+ // NewCliOutput creates a new C̄LIOutputWriter with a stdout writer
24+ func NewCliOutput (color bool ) Output {
2325 au := aurora .NewAurora (color )
2426 if run .GOOS == "windows" {
2527 au = aurora .NewAurora (false )
2628 }
2729
2830 t := newCliTemplate ()
2931
30- return OutputWriter {
32+ return CLIOutputWriter {
3133 out : os .Stdout ,
3234 au : au ,
3335 template : t ,
@@ -48,7 +50,7 @@ type TestResult struct {
4850}
4951
5052// GetEventHandler create a new runtime.EventHandler
51- func (w * OutputWriter ) GetEventHandler () * runtime.EventHandler {
53+ func (w CLIOutputWriter ) GetEventHandler () * runtime.EventHandler {
5254 handler := runtime.EventHandler {}
5355 handler .TestFinished = func (testResult runtime.TestResult ) {
5456 tr := convertTestResult (testResult )
@@ -64,7 +66,7 @@ func (w *OutputWriter) GetEventHandler() *runtime.EventHandler {
6466}
6567
6668// PrintSummary prints summary
67- func (w * OutputWriter ) PrintSummary (result runtime.Result ) bool {
69+ func (w CLIOutputWriter ) PrintSummary (result runtime.Result ) {
6870 if result .Failed > 0 {
6971 w .printFailures (result .TestResults )
7072 }
@@ -77,24 +79,22 @@ func (w *OutputWriter) PrintSummary(result runtime.Result) bool {
7779 } else {
7880 w .fprintf (w .au .Green (summary ))
7981 }
80-
81- return result .Failed == 0
8282}
8383
8484// printResult prints the simple output form of a TestReault
85- func (w * OutputWriter ) printResult (r TestResult ) {
85+ func (w CLIOutputWriter ) printResult (r TestResult ) {
8686 if ! r .Success {
8787 w .fprintf (w .au .Red (w .template .testResult (r )))
8888 return
8989 }
9090 w .fprintf (w .template .testResult (r ))
9191}
9292
93- func (w * OutputWriter ) printSkip (r TestResult ) {
93+ func (w CLIOutputWriter ) printSkip (r TestResult ) {
9494 w .fprintf (fmt .Sprintf ("- [%s] %s, was skipped" , r .Node , r .Title ))
9595}
9696
97- func (w * OutputWriter ) printFailures (results []runtime.TestResult ) {
97+ func (w CLIOutputWriter ) printFailures (results []runtime.TestResult ) {
9898 w .fprintf ("" )
9999 w .fprintf (w .au .Bold ("Results" ))
100100 w .fprintf (w .au .Bold ("" ))
@@ -118,7 +118,7 @@ func (w *OutputWriter) printFailures(results []runtime.TestResult) {
118118 }
119119}
120120
121- func (w * OutputWriter ) fprintf (a ... interface {}) {
121+ func (w CLIOutputWriter ) fprintf (a ... interface {}) {
122122 if _ , err := fmt .Fprintln (w .out , a ... ); err != nil {
123123 log .Fatal (err )
124124 }
0 commit comments