mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
more: run test only on unix systems
This commit is contained in:
parent
eed916a076
commit
53ffd55bdf
1 changed files with 12 additions and 7 deletions
|
@ -1,6 +1,10 @@
|
||||||
use crate::common::util::TestScenario;
|
use crate::common::util::TestScenario;
|
||||||
use is_terminal::IsTerminal;
|
use is_terminal::IsTerminal;
|
||||||
|
|
||||||
|
//Both following includes are only needed inside the test_more_invalid_file_perms()
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
use std::fs::{set_permissions, Permissions};
|
use std::fs::{set_permissions, Permissions};
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -36,12 +40,13 @@ fn test_more_dir_arg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
fn test_more_invalid_file_perms() {
|
fn test_more_invalid_file_perms() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
if std::io::stdout().is_terminal() {
|
||||||
let permissions = Permissions::from_mode(0o244);
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
at.make_file("invalid-perms.txt").metadata().unwrap();
|
let permissions = Permissions::from_mode(0o244);
|
||||||
set_permissions(at.plus("invalid-perms.txt"), permissions).unwrap();
|
at.make_file("invalid-perms.txt").metadata().unwrap();
|
||||||
ucmd.arg("invalid-perms.txt").fails();
|
set_permissions(at.plus("invalid-perms.txt"), permissions).unwrap();
|
||||||
//.code_is(1)
|
ucmd.arg("invalid-perms.txt").fails();
|
||||||
//.stderr_is("more: cannot open 'invalid-perms.txt': permission denied");
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue