@@ -90,16 +90,7 @@ func (c *consoleWriter) testsTable(packages []*parse.Package, option TestTableOp
9090
9191 testName := shortenTestName (t .Name , option .Trim , 32 )
9292
93- status := strings .ToUpper (t .Status ().String ())
94- switch t .Status () {
95- case parse .ActionPass :
96- status = c .green (status )
97- case parse .ActionSkip :
98- status = c .yellow (status )
99- case parse .ActionFail :
100- status = c .red (status )
101- }
102-
93+ status := c .FormatAction (t .Status ())
10394 packageName := shortenPackageName (t .Package , packagePrefix , 16 , option .Trim , option .TrimPath )
10495
10596 row := testRow {
@@ -117,7 +108,7 @@ func (c *consoleWriter) testsTable(packages []*parse.Package, option TestTableOp
117108 }
118109
119110 if data .Rows () > 0 {
120- fmt .Fprintln (c . w , tbl .Data (data ).Render ())
111+ fmt .Fprintln (c , tbl .Data (data ).Render ())
121112 }
122113}
123114
@@ -159,24 +150,16 @@ func (c *consoleWriter) testsTableMarkdown(packages []*parse.Package, option Tes
159150
160151 testName := shortenTestName (t .Name , option .Trim , 32 )
161152
162- status := strings .ToUpper (t .Status ().String ())
163- switch t .Status () {
164- case parse .ActionPass :
165- status = c .green (status )
166- case parse .ActionSkip :
167- status = c .yellow (status )
168- case parse .ActionFail :
169- status = c .red (status )
170- }
153+ status := c .FormatAction (t .Status ())
171154 data .Append ([]string {
172155 status ,
173156 strconv .FormatFloat (t .Elapsed (), 'f' , 2 , 64 ),
174157 testName ,
175158 })
176159 }
177160 if data .Rows () > 0 {
178- fmt .Fprintf (c . w , "## 📦 Package **`%s`**\n " , pkg .Summary .Package )
179- fmt .Fprintln (c . w )
161+ fmt .Fprintf (c , "## 📦 Package **`%s`**\n " , pkg .Summary .Package )
162+ fmt .Fprintln (c )
180163
181164 msg := fmt .Sprintf ("Tests: ✓ %d passed | %d skipped | %d failed\n " ,
182165 pkgTests .passedCount ,
@@ -189,18 +172,18 @@ func (c *consoleWriter) testsTableMarkdown(packages []*parse.Package, option Tes
189172 pkgTests .passedCount ,
190173 )
191174 }
192- fmt .Fprint (c . w , msg )
193-
194- fmt .Fprintln (c . w )
195- fmt .Fprintln (c . w , "<details>" )
196- fmt .Fprintln (c . w )
197- fmt .Fprintln (c . w , "<summary>Click for test summary</summary>" )
198- fmt .Fprintln (c . w )
199- fmt .Fprintln (c . w , tbl .Data (data ).Render ())
200- fmt .Fprintln (c . w , "</details>" )
201- fmt .Fprintln (c . w )
175+ fmt .Fprint (c , msg )
176+
177+ fmt .Fprintln (c )
178+ fmt .Fprintln (c , "<details>" )
179+ fmt .Fprintln (c )
180+ fmt .Fprintln (c , "<summary>Click for test summary</summary>" )
181+ fmt .Fprintln (c )
182+ fmt .Fprintln (c , tbl .Data (data ).Render ())
183+ fmt .Fprintln (c , "</details>" )
184+ fmt .Fprintln (c )
202185 }
203- fmt .Fprintln (c . w )
186+ fmt .Fprintln (c )
204187 }
205188}
206189
0 commit comments