File tree Expand file tree Collapse file tree 5 files changed +30
-12
lines changed Expand file tree Collapse file tree 5 files changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -213,8 +213,14 @@ impl LanguagePlugin for CSharpPlugin {
213213 OutputWithTimeout :: Output ( output) => {
214214 if !output. status . success ( ) {
215215 let mut logs = HashMap :: new ( ) ;
216- logs. insert ( "stdout" . to_string ( ) , output. stdout ) ;
217- logs. insert ( "stderr" . to_string ( ) , output. stderr ) ;
216+ logs. insert (
217+ "stdout" . to_string ( ) ,
218+ String :: from_utf8_lossy ( & output. stdout ) . into_owned ( ) ,
219+ ) ;
220+ logs. insert (
221+ "stderr" . to_string ( ) ,
222+ String :: from_utf8_lossy ( & output. stderr ) . into_owned ( ) ,
223+ ) ;
218224 return Ok ( RunResult {
219225 status : RunStatus :: CompileFailed ,
220226 test_results : vec ! [ ] ,
@@ -386,7 +392,10 @@ mod test {
386392 let res = plugin. run_tests ( temp. path ( ) ) . unwrap ( ) ;
387393 assert_eq ! ( res. status, RunStatus :: CompileFailed ) ;
388394 assert ! ( !res. logs. is_empty( ) ) ;
389- assert ! ( String :: from_utf8_lossy( res. logs. get( "stdout" ) . unwrap( ) )
395+ assert ! ( res
396+ . logs
397+ . get( "stdout" )
398+ . unwrap( )
390399 . contains( "This is a compile error" ) ) ;
391400 }
392401
Original file line number Diff line number Diff line change @@ -61,8 +61,14 @@ pub(crate) trait JavaPlugin: LanguagePlugin {
6161 }
6262
6363 let mut logs = HashMap :: new ( ) ;
64- logs. insert ( "stdout" . to_string ( ) , results. stdout . clone ( ) ) ;
65- logs. insert ( "stderr" . to_string ( ) , results. stderr . clone ( ) ) ;
64+ logs. insert (
65+ "stdout" . to_string ( ) ,
66+ String :: from_utf8_lossy ( & results. stdout ) . into_owned ( ) ,
67+ ) ;
68+ logs. insert (
69+ "stderr" . to_string ( ) ,
70+ String :: from_utf8_lossy ( & results. stderr ) . into_owned ( ) ,
71+ ) ;
6672 Ok ( RunResult {
6773 status,
6874 test_results,
@@ -228,8 +234,14 @@ pub(crate) trait JavaPlugin: LanguagePlugin {
228234 /// Creates a run result from a failed compilation.
229235 fn run_result_from_failed_compilation ( & self , compile_result : CompileResult ) -> RunResult {
230236 let mut logs = HashMap :: new ( ) ;
231- logs. insert ( "stdout" . to_string ( ) , compile_result. stdout ) ;
232- logs. insert ( "stderr" . to_string ( ) , compile_result. stderr ) ;
237+ logs. insert (
238+ "stdout" . to_string ( ) ,
239+ String :: from_utf8_lossy ( & compile_result. stdout ) . into_owned ( ) ,
240+ ) ;
241+ logs. insert (
242+ "stderr" . to_string ( ) ,
243+ String :: from_utf8_lossy ( & compile_result. stderr ) . into_owned ( ) ,
244+ ) ;
233245 RunResult {
234246 status : RunStatus :: CompileFailed ,
235247 test_results : vec ! [ ] ,
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ impl From<RRunResult> for RunResult {
2929 . backtrace
3030 . into_iter ( )
3131 . map ( |s| format ! ( "{}\n " , s) )
32- . flat_map ( |s| s. as_bytes ( ) . to_vec ( ) )
3332 . collect ( ) ,
3433 ) ;
3534 }
Original file line number Diff line number Diff line change @@ -267,7 +267,6 @@ mod test {
267267 assert ! ( run. test_results. is_empty( ) ) ;
268268 assert ! ( !run. logs. is_empty( ) ) ;
269269 let logs = run. logs . remove ( "compiler_output" ) . unwrap ( ) ;
270- let logs = String :: from_utf8 ( logs) . unwrap ( ) ;
271270 assert ! ( logs. contains( "unexpected 'in'" ) )
272271 }
273272
@@ -282,7 +281,6 @@ mod test {
282281 assert ! ( run. test_results. is_empty( ) ) ;
283282 assert ! ( !run. logs. is_empty( ) ) ;
284283 let logs = run. logs . remove ( "compiler_output" ) . unwrap ( ) ;
285- let logs = String :: from_utf8 ( logs) . unwrap ( ) ;
286284 assert ! ( logs. contains( "unexpected 'in'" ) ) ;
287285 }
288286
Original file line number Diff line number Diff line change @@ -67,14 +67,14 @@ pub struct RunResult {
6767 pub test_results : Vec < TestResult > ,
6868 /// Logs from the test run.
6969 /// The key may be an arbitrary string identifying the type of log.
70- pub logs : HashMap < String , Vec < u8 > > ,
70+ pub logs : HashMap < String , String > ,
7171}
7272
7373impl RunResult {
7474 pub fn new (
7575 status : RunStatus ,
7676 test_results : Vec < TestResult > ,
77- logs : HashMap < String , Vec < u8 > > ,
77+ logs : HashMap < String , String > ,
7878 ) -> Self {
7979 Self {
8080 status,
You can’t perform that action at this time.
0 commit comments