mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #7622 from blyxxyz/flush-bufwriters
Flush `BufWriter`s, clean up error reporting
This commit is contained in:
commit
8040305715
19 changed files with 173 additions and 63 deletions
|
@ -375,3 +375,15 @@ fn test_output_delimiter_with_adjacent_ranges() {
|
|||
.succeeds()
|
||||
.stdout_only("ab:cd\n");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.arg("-d=")
|
||||
.arg("-f1")
|
||||
.pipe_in("key=value")
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("cut: write error: No space left on device\n");
|
||||
}
|
||||
|
|
|
@ -163,3 +163,14 @@ fn test_format() {
|
|||
.succeeds()
|
||||
.stdout_only("\\xx {}{}{a}{}{}\n");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.arg("-G")
|
||||
.pipe_in("hello")
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("ptx: write failed: No space left on device\n");
|
||||
}
|
||||
|
|
|
@ -1335,3 +1335,13 @@ fn test_human_blocks_r_and_q() {
|
|||
fn test_args_check_conflict() {
|
||||
new_ucmd!().arg("-c").arg("-C").fails();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.pipe_in("hello")
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("sort: write failed: 'standard output': No space left on device\n");
|
||||
}
|
||||
|
|
|
@ -309,3 +309,13 @@ fn test_regex_before() {
|
|||
// |--------||----||---|
|
||||
.stdout_is("+---+c+d-e+--++b+-+a+");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.pipe_in("hello")
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("tac: failed to write to stdout: No space left on device (os error 28)\n");
|
||||
}
|
||||
|
|
|
@ -4843,3 +4843,13 @@ fn test_child_when_run_with_stderr_to_stdout() {
|
|||
.fails()
|
||||
.stdout_only(expected_stdout);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.pipe_in("hello")
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("tail: No space left on device\n");
|
||||
}
|
||||
|
|
|
@ -1545,3 +1545,14 @@ fn test_non_digit_repeat() {
|
|||
.fails()
|
||||
.stderr_only("tr: invalid repeat count 'c' in [c*n] construct\n");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.pipe_in("hello")
|
||||
.args(&["e", "a"])
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("tr: write error: No space left on device\n");
|
||||
}
|
||||
|
|
|
@ -1181,3 +1181,14 @@ fn test_stdin_w1_multibyte() {
|
|||
.succeeds()
|
||||
.stdout_is("à\ná\n");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn test_failed_write_is_reported() {
|
||||
new_ucmd!()
|
||||
.pipe_in("hello")
|
||||
.args(&["-z"])
|
||||
.set_stdout(std::fs::File::create("/dev/full").unwrap())
|
||||
.fails()
|
||||
.stderr_is("uniq: write error: No space left on device\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue