mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
nl: handle line number overflow
This commit is contained in:
parent
15c27cd545
commit
d604f709ce
2 changed files with 22 additions and 1 deletions
|
@ -464,3 +464,21 @@ fn test_invalid_regex_numbering() {
|
|||
.stderr_contains("invalid regular expression");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_line_number_overflow() {
|
||||
new_ucmd!()
|
||||
.arg(format!("--starting-line-number={}", i64::MAX))
|
||||
.pipe_in("a\nb")
|
||||
.fails()
|
||||
.stdout_is(format!("{}\ta\n", i64::MAX))
|
||||
.stderr_is("nl: line number overflow\n");
|
||||
|
||||
new_ucmd!()
|
||||
.arg(format!("--starting-line-number={}", i64::MIN))
|
||||
.arg("--line-increment=-1")
|
||||
.pipe_in("a\nb")
|
||||
.fails()
|
||||
.stdout_is(format!("{}\ta\n", i64::MIN))
|
||||
.stderr_is("nl: line number overflow\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue