mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #6000 from BenWiederhake/dev-pipein-fails-flake
tests: Harden two tests, prevent 4 flaky tests (cat, numfmt, sort, split, tee)
This commit is contained in:
commit
769c5ca7a5
5 changed files with 20 additions and 4 deletions
|
@ -175,6 +175,7 @@ fn test_piped_to_dev_full() {
|
||||||
s.ucmd()
|
s.ucmd()
|
||||||
.set_stdout(dev_full)
|
.set_stdout(dev_full)
|
||||||
.pipe_in_fixture("alpha.txt")
|
.pipe_in_fixture("alpha.txt")
|
||||||
|
.ignore_stdin_write_error()
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_contains("No space left on device");
|
.stderr_contains("No space left on device");
|
||||||
}
|
}
|
||||||
|
@ -224,6 +225,7 @@ fn test_three_directories_and_file_and_stdin() {
|
||||||
"test_directory3",
|
"test_directory3",
|
||||||
])
|
])
|
||||||
.pipe_in("stdout bytes")
|
.pipe_in("stdout bytes")
|
||||||
|
.ignore_stdin_write_error()
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
|
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
|
||||||
.stdout_is(
|
.stdout_is(
|
||||||
|
|
|
@ -666,7 +666,12 @@ fn test_invalid_stdin_number_returns_status_2() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid_stdin_number_in_middle_of_input() {
|
fn test_invalid_stdin_number_in_middle_of_input() {
|
||||||
new_ucmd!().pipe_in("100\nhello\n200").fails().code_is(2);
|
new_ucmd!()
|
||||||
|
.pipe_in("100\nhello\n200")
|
||||||
|
.ignore_stdin_write_error()
|
||||||
|
.fails()
|
||||||
|
.stdout_is("100\n")
|
||||||
|
.code_is(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -813,8 +813,6 @@ fn test_check_silent() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_check_unique() {
|
fn test_check_unique() {
|
||||||
// Due to a clap bug the combination "-cu" does not work. "-c -u" works.
|
|
||||||
// See https://github.com/clap-rs/clap/issues/2624
|
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["-c", "-u"])
|
.args(&["-c", "-u"])
|
||||||
.pipe_in("A\nA\n")
|
.pipe_in("A\nA\n")
|
||||||
|
@ -823,6 +821,16 @@ fn test_check_unique() {
|
||||||
.stderr_only("sort: -:2: disorder: A\n");
|
.stderr_only("sort: -:2: disorder: A\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_check_unique_combined() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["-cu"])
|
||||||
|
.pipe_in("A\nA\n")
|
||||||
|
.fails()
|
||||||
|
.code_is(1)
|
||||||
|
.stderr_only("sort: -:2: disorder: A\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dictionary_and_nonprinting_conflicts() {
|
fn test_dictionary_and_nonprinting_conflicts() {
|
||||||
let conflicting_args = ["n", "h", "g", "M"];
|
let conflicting_args = ["n", "h", "g", "M"];
|
||||||
|
|
|
@ -1068,6 +1068,7 @@ fn test_split_number_oversized_stdin() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["--number=3", "---io-blksize=600"])
|
.args(&["--number=3", "---io-blksize=600"])
|
||||||
.pipe_in_fixture("sixhundredfiftyonebytes.txt")
|
.pipe_in_fixture("sixhundredfiftyonebytes.txt")
|
||||||
|
.ignore_stdin_write_error()
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_only("split: -: cannot determine input size\n");
|
.stderr_only("split: -: cannot determine input size\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ fn test_tee_no_more_writeable_1() {
|
||||||
// equals to 'tee /dev/full out2 <multi_read' call
|
// equals to 'tee /dev/full out2 <multi_read' call
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
let content = (1..=10).fold(String::new(), |mut output, x| {
|
let content = (1..=10).fold(String::new(), |mut output, x| {
|
||||||
let _ = writeln!(output, "{x}");
|
writeln!(output, "{x}").unwrap();
|
||||||
output
|
output
|
||||||
});
|
});
|
||||||
let file_out = "tee_file_out";
|
let file_out = "tee_file_out";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue