@@ -13,6 +13,8 @@ pub fn compare_trace_output(
1313) -> anyhow:: Result < ( ) > {
1414 let expected_trace = expected_path. read_to_string ( ) ?. replace ( "\r \n " , "\n " ) ;
1515
16+ let ruffle_expected_path = path_with_suffix ( expected_path, "ruffle" ) ?;
17+
1618 // Null bytes are invisible, and interfere with constructing
1719 // the expected output.txt file. Any tests dealing with null
1820 // bytes should explicitly test for them in ActionScript.
@@ -21,7 +23,16 @@ pub fn compare_trace_output(
2123 let result = test ( "flash_expected" , approx, & expected_trace, & actual_trace) ;
2224
2325 match known_failure {
24- KnownFailure :: None | KnownFailure :: Panic { .. } => result,
26+ KnownFailure :: None | KnownFailure :: Panic { .. } => {
27+ if result. is_ok ( ) && ruffle_expected_path. exists ( ) ? {
28+ Err ( anyhow ! (
29+ "Unexpected `{}` file for passing check, please remove it!" ,
30+ ruffle_expected_path. as_str( ) ,
31+ ) )
32+ } else {
33+ result
34+ }
35+ }
2536 KnownFailure :: TraceOutput {
2637 ruffle_check : false ,
2738 } => {
@@ -35,20 +46,20 @@ pub fn compare_trace_output(
3546 }
3647 }
3748 KnownFailure :: TraceOutput { ruffle_check : true } => {
38- let path = path_with_suffix ( expected_path, "ruffle" ) ?;
39-
4049 if result. is_ok ( ) {
4150 return Err ( anyhow ! (
4251 "Trace output check was known to be failing, but now passes successfully. \
4352 Please update the test, and remove `known_failure = true` and `{}`!",
44- path . as_str( ) ,
53+ ruffle_expected_path . as_str( ) ,
4554 ) ) ;
4655 }
4756
48- let expected_trace = if path . exists ( ) ? {
49- path . read_to_string ( ) ?. replace ( "\r \n " , "\n " )
57+ let expected_trace = if ruffle_expected_path . exists ( ) ? {
58+ ruffle_expected_path . read_to_string ( ) ?. replace ( "\r \n " , "\n " )
5059 } else {
51- path. create_file ( ) ?. write_all ( actual_trace. as_bytes ( ) ) ?;
60+ ruffle_expected_path
61+ . create_file ( ) ?
62+ . write_all ( actual_trace. as_bytes ( ) ) ?;
5263 return Err ( anyhow ! (
5364 "No trace to compare to! Saved actual trace as Ruffle-expected."
5465 ) ) ;
0 commit comments