@@ -30,20 +30,20 @@ impl<T: Write> PrettyFormatter<T> {
30
30
& self . out
31
31
}
32
32
33
- pub fn write_ok ( & mut self ) -> io:: Result < ( ) > {
34
- self . write_short_result ( "ok" , term:: color:: GREEN )
33
+ pub fn write_ok ( & mut self , exec_time : Option < & TestExecTime > ) -> io:: Result < ( ) > {
34
+ self . write_short_result ( "ok" , term:: color:: GREEN , exec_time )
35
35
}
36
36
37
- pub fn write_failed ( & mut self ) -> io:: Result < ( ) > {
38
- self . write_short_result ( "FAILED" , term:: color:: RED )
37
+ pub fn write_failed ( & mut self , exec_time : Option < & TestExecTime > ) -> io:: Result < ( ) > {
38
+ self . write_short_result ( "FAILED" , term:: color:: RED , exec_time )
39
39
}
40
40
41
- pub fn write_ignored ( & mut self ) -> io:: Result < ( ) > {
42
- self . write_short_result ( "ignored" , term:: color:: YELLOW )
41
+ pub fn write_ignored ( & mut self , exec_time : Option < & TestExecTime > ) -> io:: Result < ( ) > {
42
+ self . write_short_result ( "ignored" , term:: color:: YELLOW , exec_time )
43
43
}
44
44
45
- pub fn write_allowed_fail ( & mut self ) -> io:: Result < ( ) > {
46
- self . write_short_result ( "FAILED (allowed)" , term:: color:: YELLOW )
45
+ pub fn write_allowed_fail ( & mut self , exec_time : Option < & TestExecTime > ) -> io:: Result < ( ) > {
46
+ self . write_short_result ( "FAILED (allowed)" , term:: color:: YELLOW , exec_time )
47
47
}
48
48
49
49
pub fn write_bench ( & mut self ) -> io:: Result < ( ) > {
@@ -54,8 +54,12 @@ impl<T: Write> PrettyFormatter<T> {
54
54
& mut self ,
55
55
result : & str ,
56
56
color : term:: color:: Color ,
57
+ exec_time : Option < & TestExecTime > ,
57
58
) -> io:: Result < ( ) > {
58
59
self . write_pretty ( result, color) ?;
60
+ if let Some ( exec_time) = exec_time {
61
+ self . write_plain ( format ! ( " {}" , exec_time) ) ?;
62
+ }
59
63
self . write_plain ( "\n " )
60
64
}
61
65
@@ -166,6 +170,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
166
170
& mut self ,
167
171
desc : & TestDesc ,
168
172
result : & TestResult ,
173
+ exec_time : Option < & TestExecTime > ,
169
174
_: & [ u8 ] ,
170
175
_: & ConsoleTestState ,
171
176
) -> io:: Result < ( ) > {
@@ -174,10 +179,10 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
174
179
}
175
180
176
181
match * result {
177
- TrOk => self . write_ok ( ) ,
178
- TrFailed | TrFailedMsg ( _) => self . write_failed ( ) ,
179
- TrIgnored => self . write_ignored ( ) ,
180
- TrAllowedFail => self . write_allowed_fail ( ) ,
182
+ TrOk => self . write_ok ( exec_time ) ,
183
+ TrFailed | TrFailedMsg ( _) => self . write_failed ( exec_time ) ,
184
+ TrIgnored => self . write_ignored ( exec_time ) ,
185
+ TrAllowedFail => self . write_allowed_fail ( exec_time ) ,
181
186
TrBench ( ref bs) => {
182
187
self . write_bench ( ) ?;
183
188
self . write_plain ( & format ! ( ": {}\n " , fmt_bench_samples( bs) ) )
0 commit comments