@@ -28,6 +28,8 @@ fn write_whole_file(path: &Path, data: &str) -> IoResult<()> {
28
28
29
29
30
30
fn print_json_diff ( results : & json:: Json , expected : & json:: Json ) -> IoResult < ( ) > {
31
+ use std:: io:: stdio:: stdout;
32
+
31
33
let temp = try!( TempDir :: new ( "rust-cssparser-tests" ) ) ;
32
34
let results = results. to_pretty_str ( ) + "\n " ;
33
35
let expected = expected. to_pretty_str ( ) + "\n " ;
@@ -37,13 +39,13 @@ fn print_json_diff(results: &json::Json, expected: &json::Json) -> IoResult<()>
37
39
expected_path. push ( "expected.json" ) ;
38
40
try!( write_whole_file ( & result_path, results. as_slice ( ) ) ) ;
39
41
try!( write_whole_file ( & expected_path, expected. as_slice ( ) ) ) ;
40
- try!( Command :: new ( "colordiff" )
42
+ stdout ( ) . write ( try!( Command :: new ( "colordiff" )
41
43
. arg ( "-u1000" )
42
44
. arg ( result_path. display ( ) . to_string ( ) )
43
45
. arg ( expected_path. display ( ) . to_string ( ) )
44
- . status ( )
45
- . map_err ( |_| io:: standard_error ( io:: OtherIoError ) ) ) ;
46
- Ok ( ( ) )
46
+ . output ( )
47
+ . map_err ( |_| io:: standard_error ( io:: OtherIoError ) )
48
+ ) . output . as_slice ( ) )
47
49
}
48
50
49
51
@@ -69,7 +71,7 @@ fn almost_equals(a: &json::Json, b: &json::Json) -> bool {
69
71
70
72
fn assert_json_eq ( results : json:: Json , expected : json:: Json , message : String ) {
71
73
if !almost_equals ( & results, & expected) {
72
- let _ = print_json_diff ( & results, & expected) . unwrap ( ) ;
74
+ print_json_diff ( & results, & expected) . unwrap ( ) ;
73
75
panic ! ( message)
74
76
}
75
77
}
0 commit comments