File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,16 @@ fn test_infer_dot_star() -> Result<(), Box<dyn std::error::Error>> {
9292 let expected_output = fs:: read_to_string ( "test/infer_dot_star/expected/expected.sv" ) ?;
9393 let mut cmd = Command :: cargo_bin ( "morty" ) ?;
9494 cmd. arg ( "--infer_dot_star" )
95- . arg ( "test/infer_dot_star/top.sv" )
96- . arg ( "test/infer_dot_star/submodule.sv" ) ;
97- cmd. assert ( )
98- . success ( )
99- . stdout ( predicate:: str:: contains ( expected_output) ) ;
100-
95+ . arg ( Path :: new ( "test/infer_dot_star/top.sv" ) . as_os_str ( ) )
96+ . arg ( Path :: new ( "test/infer_dot_star/submodule.sv" ) . as_os_str ( ) ) ;
97+ let binding = cmd. assert ( ) . success ( ) ;
98+ // we have to do it this complex such that windows tests are passing
99+ // windows has a different output format and injects \r into the output
100+ let output = & binding. get_output ( ) . stdout ;
101+ let output_str = String :: from_utf8 ( output. clone ( ) ) . unwrap ( ) ;
102+ let expected_output_stripped = expected_output. replace ( & [ '\r' ] [ ..] , "" ) ;
103+ let output_str_stripped = output_str. replace ( & [ '\r' ] [ ..] , "" ) ;
104+ let compare_fn = predicate:: str:: contains ( expected_output_stripped) ;
105+ assert_eq ! ( compare_fn. eval( & output_str_stripped) , true ) ;
101106 Ok ( ( ) )
102107}
You can’t perform that action at this time.
0 commit comments