File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,20 +11,25 @@ pub fn assert_contains(
1111 expected_path : & Path ,
1212 expected_mode : AccessMode ,
1313) {
14- accesses
15- . iter ( )
16- . find ( |access| {
17- let Ok ( stripped) =
18- access. path . strip_path_prefix :: < _ , Result < PathBuf , StripPrefixError > , _ > (
19- expected_path,
20- |strip_result| strip_result. map ( Path :: to_path_buf) ,
21- )
22- else {
23- return false ;
24- } ;
25- stripped. as_os_str ( ) . is_empty ( ) && access. mode == expected_mode
26- } )
27- . unwrap ( ) ;
14+ let found = accesses. iter ( ) . any ( |access| {
15+ let Ok ( stripped) =
16+ access. path . strip_path_prefix :: < _ , Result < PathBuf , StripPrefixError > , _ > (
17+ expected_path,
18+ |strip_result| strip_result. map ( Path :: to_path_buf) ,
19+ )
20+ else {
21+ return false ;
22+ } ;
23+ stripped. as_os_str ( ) . is_empty ( ) && access. mode == expected_mode
24+ } ) ;
25+ if !found {
26+ panic ! (
27+ "Expected to find access to path {:?} with mode {:?}, but it was not found in: {:?}" ,
28+ expected_path,
29+ expected_mode,
30+ accesses. iter( ) . collect:: <Vec <_>>( )
31+ ) ;
32+ }
2833}
2934
3035#[ macro_export]
You can’t perform that action at this time.
0 commit comments