mirror of
https://github.com/nushell/nushell.git
synced 2024-12-24 16:09:11 +01:00
Allow for test_iteration_errors to work when run as root (#5609)
* allow for test_iteration_errors to work when run as root * Add comment to skip condition Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
parent
1e89cc3578
commit
5bc9246f0f
@ -936,16 +936,19 @@ mod test {
|
|||||||
use std::io;
|
use std::io;
|
||||||
let mut iter = glob("/root/*").unwrap();
|
let mut iter = glob("/root/*").unwrap();
|
||||||
|
|
||||||
// GlobErrors shouldn't halt iteration
|
// Skip test if running with permissions to read /root
|
||||||
let next = iter.next();
|
if std::fs::read_dir("/root/").is_err() {
|
||||||
assert!(next.is_some());
|
// GlobErrors shouldn't halt iteration
|
||||||
|
let next = iter.next();
|
||||||
|
assert!(next.is_some());
|
||||||
|
|
||||||
let err = next.unwrap();
|
let err = next.unwrap();
|
||||||
assert!(err.is_err());
|
assert!(err.is_err());
|
||||||
|
|
||||||
let err = err.err().unwrap();
|
let err = err.err().unwrap();
|
||||||
assert!(err.path() == Path::new("/root"));
|
assert!(err.path() == Path::new("/root"));
|
||||||
assert!(err.error().kind() == io::ErrorKind::PermissionDenied);
|
assert!(err.error().kind() == io::ErrorKind::PermissionDenied);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user