File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -899,13 +899,24 @@ mod test {
899
899
assert ! ( glob( "abc[def" ) . err( ) . unwrap( ) . pos == 3 ) ;
900
900
}
901
901
902
+ // this test assumes that there is a /root directory and that
903
+ // the user running this test is not root or otherwise doesn't
904
+ // have permission to read its contents
902
905
#[ cfg( unix) ]
903
906
#[ test]
904
907
fn test_iteration_errors ( ) {
905
908
let mut iter = glob ( "/root/*" ) . unwrap ( ) ;
909
+
910
+ // GlobErrors shouldn't halt iteration
906
911
let next = iter. next ( ) ;
907
912
assert ! ( next. is_some( ) ) ;
908
- assert ! ( next. unwrap( ) . is_err( ) ) ;
913
+
914
+ let err = next. unwrap ( ) ;
915
+ assert ! ( err. is_err( ) ) ;
916
+
917
+ let err = err. unwrap_err ( ) ;
918
+ assert ! ( * err. path( ) == Path :: new( "/root" ) ) ;
919
+ assert ! ( err. error( ) . kind == :: std:: io:: IoErrorKind :: PermissionDenied ) ;
909
920
}
910
921
911
922
#[ test]
You can’t perform that action at this time.
0 commit comments