Fix up stat test in libc-fs-with-isolation
The test relied on Error::last_os_error() coming from the stat call on the passed file, but there is no guarantee this will be the case. Instead extract errno from the error returned by the routine. Patch de facto written by joboet. Co-authored-by: joboet <jonasboettiger@icloud.com>
This commit is contained in:
parent
3254bef9a7
commit
753e576722
@ -22,7 +22,8 @@ fn main() {
|
||||
}
|
||||
|
||||
// test `stat`
|
||||
assert_eq!(fs::metadata("foo.txt").unwrap_err().kind(), ErrorKind::PermissionDenied);
|
||||
let err = fs::metadata("foo.txt").unwrap_err();
|
||||
assert_eq!(err.kind(), ErrorKind::PermissionDenied);
|
||||
// check that it is the right kind of `PermissionDenied`
|
||||
assert_eq!(Error::last_os_error().raw_os_error(), Some(libc::EACCES));
|
||||
assert_eq!(err.raw_os_error(), Some(libc::EACCES));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user