@@ -99,6 +99,10 @@ fn test_binary_view_strings() {
9999 assert_eq ! ( str_15dc. length, 33 ) ;
100100}
101101
102+ // These are the target files present in OUT_DIR
103+ // Add the files to fixtures/bin
104+ static TARGET_FILES : [ & str ; 2 ] = [ "atox.obj" , "atof.obj" ] ;
105+
102106// This is what we store to check if a function matches the expected function.
103107// See `test_deterministic_functions` for details.
104108#[ derive( Debug , PartialEq ) ]
@@ -120,19 +124,16 @@ impl From<&Function> for FunctionSnapshot {
120124fn test_deterministic_functions ( ) {
121125 let session = Session :: new ( ) . expect ( "Failed to initialize session" ) ;
122126 let out_dir = env ! ( "OUT_DIR" ) . parse :: < PathBuf > ( ) . unwrap ( ) ;
123- for entry in std:: fs:: read_dir ( out_dir) . expect ( "Failed to read OUT_DIR" ) {
124- let entry = entry. expect ( "Failed to read directory entry" ) ;
125- let path = entry. path ( ) ;
126- if path. is_file ( ) {
127- let view = session. load ( & path) . expect ( "Failed to load view" ) ;
128- assert_eq ! ( view. analysis_progress( ) . state, AnalysisState :: IdleState ) ;
129- let functions: BTreeMap < u64 , FunctionSnapshot > = view
130- . functions ( )
131- . iter ( )
132- . map ( |f| ( f. start ( ) , FunctionSnapshot :: from ( f. as_ref ( ) ) ) )
133- . collect ( ) ;
134- let snapshot_name = path. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
135- insta:: assert_debug_snapshot!( snapshot_name, functions) ;
136- }
127+ for file_name in TARGET_FILES {
128+ let path = out_dir. join ( file_name) ;
129+ let view = session. load ( & path) . expect ( "Failed to load view" ) ;
130+ assert_eq ! ( view. analysis_progress( ) . state, AnalysisState :: IdleState ) ;
131+ let functions: BTreeMap < u64 , FunctionSnapshot > = view
132+ . functions ( )
133+ . iter ( )
134+ . map ( |f| ( f. start ( ) , FunctionSnapshot :: from ( f. as_ref ( ) ) ) )
135+ . collect ( ) ;
136+ let snapshot_name = path. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
137+ insta:: assert_debug_snapshot!( snapshot_name, functions) ;
137138 }
138139}
0 commit comments