mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Adding failing GNU head tests (#1579)
Co-authored-by: Chad Brewbaker <chad@flyingdogsolutions.com>
This commit is contained in:
parent
ba6b55f117
commit
c1f518e586
1 changed files with 71 additions and 0 deletions
|
@ -85,3 +85,74 @@ fn test_verbose() {
|
|||
.run()
|
||||
.stdout_is_fixture("lorem_ipsum_verbose.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_spams_newline() {
|
||||
new_ucmd!()
|
||||
.pipe_in("a")
|
||||
.succeeds()
|
||||
.stdout_is("a\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unsupported_byte_syntax() {
|
||||
new_ucmd!()
|
||||
.args(&["-1c"])
|
||||
.pipe_in("abc")
|
||||
.fails()
|
||||
//GNU head returns "a"
|
||||
.stdout_is("")
|
||||
.stderr_is("head: error: Unrecognized option: \'1\'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unsupported_line_syntax() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "2048m"])
|
||||
.pipe_in("a\n")
|
||||
.fails()
|
||||
//.stdout_is("a\n"); What GNU head returns.
|
||||
.stdout_is("")
|
||||
.stderr_is("head: error: invalid line count \'2048m\': invalid digit found in string");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unsupported_zero_terminated_syntax() {
|
||||
new_ucmd!()
|
||||
.args(&["-z -n 1"])
|
||||
.pipe_in("x\0y")
|
||||
.fails()
|
||||
//GNU Head returns "x\0"
|
||||
.stderr_is("head: error: Unrecognized option: \'z\'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unsupported_zero_terminated_syntax_2() {
|
||||
new_ucmd!()
|
||||
.args(&["-z -n 2"])
|
||||
.pipe_in("x\0y")
|
||||
.fails()
|
||||
//GNU Head returns "x\0y"
|
||||
.stderr_is("head: error: Unrecognized option: \'z\'");
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_unsupported_negative_byte_syntax() {
|
||||
new_ucmd!()
|
||||
.args(&["--bytes=-2"])
|
||||
.pipe_in("a\n")
|
||||
.fails()
|
||||
//GNU Head returns ""
|
||||
.stderr_is("head: error: invalid byte count \'-2\': invalid digit found in string");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bug_in_negative_zero_lines() {
|
||||
new_ucmd!()
|
||||
.args(&["--lines=-0"])
|
||||
.pipe_in("a\nb\n")
|
||||
.succeeds()
|
||||
//GNU Head returns "a\nb\n"
|
||||
.stdout_is("");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue