mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #2944 from jfinkels/truncate-fifo
truncate: error when trying to truncate a fifo
This commit is contained in:
commit
c2e3f4109c
2 changed files with 80 additions and 4 deletions
|
@ -411,3 +411,38 @@ fn test_underflow_relative_size() {
|
|||
assert!(at.file_exists(FILE1));
|
||||
assert!(at.read_bytes(FILE1).is_empty());
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn test_fifo_error_size_only() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.mkfifo("fifo");
|
||||
ucmd.args(&["-s", "0", "fifo"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("cannot open 'fifo' for writing: No such device or address");
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn test_fifo_error_reference_file_only() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.mkfifo("fifo");
|
||||
at.make_file("reference_file");
|
||||
ucmd.args(&["-r", "reference_file", "fifo"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("cannot open 'fifo' for writing: No such device or address");
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn test_fifo_error_reference_and_size() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.mkfifo("fifo");
|
||||
at.make_file("reference_file");
|
||||
ucmd.args(&["-r", "reference_file", "-s", "+0", "fifo"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("cannot open 'fifo' for writing: No such device or address");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue