File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -11,25 +11,27 @@ pub fn assert_contains(
1111 expected_path : & Path ,
1212 expected_mode : AccessMode ,
1313) {
14- let found = accesses. iter ( ) . any ( |access| {
14+ let mut actual_mode: AccessMode = AccessMode :: empty ( ) ;
15+ for access in accesses. iter ( ) {
1516 let Ok ( stripped) =
1617 access. path . strip_path_prefix :: < _ , Result < PathBuf , StripPrefixError > , _ > (
1718 expected_path,
1819 |strip_result| strip_result. map ( Path :: to_path_buf) ,
1920 )
2021 else {
21- return false ;
22+ continue ;
2223 } ;
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- ) ;
24+ if stripped. as_os_str ( ) . is_empty ( ) {
25+ actual_mode. insert ( access. mode ) ;
26+ }
3227 }
28+
29+ assert_eq ! (
30+ expected_mode,
31+ actual_mode,
32+ "Expected to find access to path {:?} with mode {:?}, but it was not found in: {:?}" ,
33+ accesses. iter( ) . collect:: <Vec <_>>( )
34+ ) ;
3335}
3436
3537#[ macro_export]
You can’t perform that action at this time.
0 commit comments