@@ -30,20 +30,20 @@ impl<T: Write> PrettyFormatter<T> {
3030 & self . out
3131 }
3232
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 )
3535 }
3636
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 )
3939 }
4040
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 )
4343 }
4444
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 )
4747 }
4848
4949 pub fn write_bench ( & mut self ) -> io:: Result < ( ) > {
@@ -54,8 +54,12 @@ impl<T: Write> PrettyFormatter<T> {
5454 & mut self ,
5555 result : & str ,
5656 color : term:: color:: Color ,
57+ exec_time : Option < & TestExecTime > ,
5758 ) -> io:: Result < ( ) > {
5859 self . write_pretty ( result, color) ?;
60+ if let Some ( exec_time) = exec_time {
61+ self . write_plain ( format ! ( " {}" , exec_time) ) ?;
62+ }
5963 self . write_plain ( "\n " )
6064 }
6165
@@ -166,6 +170,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
166170 & mut self ,
167171 desc : & TestDesc ,
168172 result : & TestResult ,
173+ exec_time : Option < & TestExecTime > ,
169174 _: & [ u8 ] ,
170175 _: & ConsoleTestState ,
171176 ) -> io:: Result < ( ) > {
@@ -174,10 +179,10 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
174179 }
175180
176181 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 ) ,
181186 TrBench ( ref bs) => {
182187 self . write_bench ( ) ?;
183188 self . write_plain ( & format ! ( ": {}\n " , fmt_bench_samples( bs) ) )
0 commit comments