1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

du/sort/od/stdbuf: make error handling of SIZE/BYTES/MODE arguments more consistent

* od: add stderr info for not yet implemented '--strings' flag
This commit is contained in:
Jan Scheer 2021-06-03 21:00:03 +02:00
parent ad26b7a042
commit db3ee61742
9 changed files with 153 additions and 93 deletions

View file

@ -57,15 +57,18 @@ fn test_stdbuf_line_buffering_stdin_fails() {
#[cfg(not(target_os = "windows"))]
#[test]
fn test_stdbuf_invalid_mode_fails() {
// TODO: GNU's `stdbuf` (8.32) does not return "\nTry 'stdbuf --help' for more information."
// for invalid modes.
new_ucmd!()
.args(&["-i", "1024R", "head"])
.fails()
.stderr_contains("stdbuf: invalid mode 1024R");
#[cfg(not(target_pointer_width = "128"))]
new_ucmd!()
.args(&["--error", "1Y", "head"])
.fails()
.stderr_contains("stdbuf: invalid mode 1Y: Value too large to be stored in data type");
let options = ["--input", "--output", "--error"];
for option in &options {
new_ucmd!()
.args(&[*option, "1024R", "head"])
.fails()
.code_is(125)
.stderr_only("stdbuf: invalid mode 1024R");
#[cfg(not(target_pointer_width = "128"))]
new_ucmd!()
.args(&[*option, "1Y", "head"])
.fails()
.code_is(125)
.stderr_contains("stdbuf: invalid mode 1Y: Value too large for defined data type");
}
}