1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #2850 from sbentmar/numfmt-error-handling

numfmt: use UResult in more functions
This commit is contained in:
Sylvestre Ledru 2022-01-25 13:46:46 +01:00 committed by GitHub
commit e6733881d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 162 additions and 24 deletions

View file

@ -568,3 +568,28 @@ fn test_suffix_with_padding() {
.succeeds()
.stdout_only(" 1000pad 2000 3000\n");
}
#[test]
fn test_invalid_stdin_number_returns_status_2() {
new_ucmd!().pipe_in("hello").fails().code_is(2);
}
#[test]
fn test_invalid_stdin_number_in_middle_of_input() {
new_ucmd!().pipe_in("100\nhello\n200").fails().code_is(2);
}
#[test]
fn test_invalid_argument_number_returns_status_2() {
new_ucmd!().args(&["hello"]).fails().code_is(2);
}
#[test]
fn test_invalid_argument_returns_status_1() {
new_ucmd!()
.args(&["--header=hello"])
.pipe_in("53478")
.ignore_stdin_write_error()
.fails()
.code_is(1);
}