@@ -102,16 +102,15 @@ impl fmt::Display for RuntimeError {
102102 let seperator = "-------------------------------" ;
103103 write ! (
104104 f,
105- "{}\n Testcase {} failed during execution!\n {}\n {}\n {}\n \n {}\n {}\n {}\n {}" ,
105+ "{}\n Testcase {} failed during execution!\n {sep }\n {}\n {}\n \n {}\n {}\n {sep }\n {}" ,
106106 "Runtime Error!" . red( ) . bold( ) ,
107107 format!( "{}" , self . std_output. len( ) ) . red( ) ,
108- seperator. yellow( ) ,
109108 "Error Message :" . yellow( ) ,
110109 self . runtime_error,
111110 "Full error message :" . yellow( ) ,
112111 self . full_runtime_error,
113- seperator . yellow( ) ,
114- format! ( "{} \n {:?}" , "Std Output :" . yellow( ) , self . std_output )
112+ format! ( "{} \n {:?}" , "Std Output :" . yellow( ) , self . std_output ) ,
113+ sep = seperator . yellow( ) ,
115114 )
116115 }
117116}
@@ -136,23 +135,22 @@ impl fmt::Display for Success {
136135 for i in 0 ..self . code_answer . len ( ) {
137136 let is_correct = self . compare_result . chars ( ) . nth ( i) . unwrap_or ( '0' ) == '1' ;
138137 part2. push ( format ! (
139- "{1 }\n {2 }\n {3 }\n {0:10}: {4 :?}\n {7 :10}: {5 :?}\n \n {6 }" ,
138+ "{sep }\n {1 }\n {sep }\n {0:10}: {2 :?}\n {5 :10}: {3 :?}\n \n {4 }" ,
140139 "Output" ,
141- seperator. yellow( ) ,
142140 if is_correct {
143141 format!( "Testcase {} execution success" , i + 1 ) . green( )
144142 } else {
145143 format!( "Testcase {} execution failed" , i + 1 ) . red( )
146144 } ,
147- seperator. yellow( ) ,
148145 self . code_answer[ i] ,
149146 self . expected_code_answer[ i] ,
150147 if !self . std_output[ i] . is_empty( ) {
151148 format!( "Std Output :\n {}\n " , self . std_output[ i] )
152149 } else {
153150 String :: new( )
154151 } ,
155- "Expected"
152+ "Expected" ,
153+ sep = seperator. yellow( )
156154 ) ) ;
157155 }
158156
@@ -176,7 +174,7 @@ impl fmt::Display for Success {
176174 . italic( )
177175 . to_string( )
178176 } else {
179- "" . to_string ( )
177+ String :: new ( )
180178 } ,
181179 ) ;
182180
@@ -189,7 +187,18 @@ impl fmt::Display for Success {
189187 . min( 100 ) ,
190188 "Memory" ,
191189 ) ;
192- write ! ( f, "{}{}{}{}" , part1, part2. join( "" ) , part3, part4)
190+
191+ let part5 = format ! (
192+ "{seperator}\n {:10}: {}" ,
193+ "Status" ,
194+ if self . is_correct( ) {
195+ "Testcase execution success" . green( ) . italic( )
196+ } else {
197+ "Testcase execution failed" . yellow( ) . italic( )
198+ } ,
199+ seperator = seperator. yellow( )
200+ ) ;
201+ write ! ( f, "{}{}{}{}{}" , part1, part2. join( "" ) , part3, part4, part5)
193202 }
194203}
195204
0 commit comments