1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

truncate: add test_invalid_option

This commit is contained in:
Sam Caldwell 2022-02-01 08:29:22 -07:00
parent e1f7c774d8
commit ea5541db56

View file

@ -250,13 +250,26 @@ fn test_size_and_reference() {
#[test]
fn test_error_filename_only() {
// truncate: you must specify either '--size' or '--reference'
new_ucmd!().args(&["file"]).fails().stderr_contains(
new_ucmd!()
.args(&["file"])
.fails()
.code_is(1)
.stderr_contains(
"error: The following required arguments were not provided:
--reference <RFILE>
--size <SIZE>",
);
}
#[test]
fn test_invalid_option() {
// truncate: cli parsing error returns 1
new_ucmd!()
.args(&["--this-arg-does-not-exist"])
.fails()
.code_is(1);
}
#[test]
fn test_invalid_numbers() {
new_ucmd!()