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

head: use "parse_size" from uucore

This commit is contained in:
Jan Scheer 2021-06-01 09:30:43 +02:00
parent 8bf1e33b5d
commit 84f2bff778
3 changed files with 42 additions and 127 deletions

View file

@ -242,3 +242,28 @@ hello
",
);
}
#[test]
fn test_head_invalid_num() {
new_ucmd!()
.args(&["-c", "1024R", "emptyfile.txt"])
.fails()
.stderr_is("head: invalid number of bytes: 1024R");
new_ucmd!()
.args(&["-n", "1024R", "emptyfile.txt"])
.fails()
.stderr_is("head: invalid number of lines: 1024R");
#[cfg(not(target_pointer_width = "128"))]
new_ucmd!()
.args(&["-c", "1Y", "emptyfile.txt"])
.fails()
.stderr_is(
"head: invalid number of bytes: 1Y: Value too large to be stored in data type",
);
#[cfg(not(target_pointer_width = "128"))]
new_ucmd!()
.args(&["-n", "1Y", "emptyfile.txt"])
.fails()
.stderr_is(
"head: invalid number of lines: 1Y: Value too large to be stored in data type",
);
}