Skip to content

Commit

Permalink
numfmt: add support for arg numbers using --invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
sbentmar committed Jan 2, 2023
1 parent 177057e commit 53ca5e7
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/by-util/test_numfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,42 @@ fn test_invalid_stdin_number_with_fail_returns_status_2() {
.stderr_is("numfmt: invalid suffix in input: '4Q'\n");
}

#[test]
fn test_invalid_arg_number_with_warn_returns_status_0() {
new_ucmd!()
.args(&["--invalid=warn", "4Q"])
.succeeds()
.stdout_is("4Q\n")
.stderr_is("numfmt: invalid suffix in input: '4Q'\n");
}

#[test]
fn test_invalid_arg_number_with_ignore_returns_status_0() {
new_ucmd!()
.args(&["--invalid=ignore", "4Q"])
.succeeds()
.stdout_only("4Q\n");
}

#[test]
fn test_invalid_arg_number_with_abort_returns_status_2() {
new_ucmd!()
.args(&["--invalid=abort", "4Q"])
.fails()
.code_is(2)
.stderr_only("numfmt: invalid suffix in input: '4Q'\n");
}

#[test]
fn test_invalid_arg_number_with_fail_returns_status_2() {
new_ucmd!()
.args(&["--invalid=fail", "4Q"])
.fails()
.code_is(2)
.stdout_is("4Q\n")
.stderr_is("numfmt: invalid suffix in input: '4Q'\n");
}

#[test]
fn test_invalid_argument_returns_status_1() {
new_ucmd!()
Expand Down

0 comments on commit 53ca5e7

Please sign in to comment.