mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
shred: fails in case of permissions issue
This commit is contained in:
parent
844f077401
commit
bb5111cc71
2 changed files with 27 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
// spell-checker:ignore wipesync
|
||||
|
||||
use crate::common::util::TestScenario;
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
|
@ -163,3 +164,26 @@ fn test_shred_empty() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(unix, feature = "chmod"))]
|
||||
fn test_shred_fail_no_perm() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
let dir = "dir";
|
||||
|
||||
let file = "test_shred_remove_a";
|
||||
|
||||
let binding = Path::new("dir").join(file);
|
||||
let path = binding.to_str().unwrap();
|
||||
at.mkdir(dir);
|
||||
at.touch(path);
|
||||
scene.ccmd("chmod").arg("a-w").arg(dir).succeeds();
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-uv")
|
||||
.arg(path)
|
||||
.fails()
|
||||
.stderr_contains("Couldn't rename to");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue