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

nl: defer showing "line number overflow" error

This commit is contained in:
Daniel Hofstetter 2023-09-30 15:35:05 +02:00
parent bc7877b58c
commit 95ccc54d05
2 changed files with 26 additions and 7 deletions

View file

@ -539,6 +539,22 @@ fn test_line_number_overflow() {
.stderr_is("nl: line number overflow\n");
}
#[test]
fn test_line_number_no_overflow() {
new_ucmd!()
.arg(format!("--starting-line-number={}", i64::MAX))
.pipe_in("a\n\\:\\:\nb")
.succeeds()
.stdout_is(format!("{0}\ta\n\n{0}\tb\n", i64::MAX));
new_ucmd!()
.arg(format!("--starting-line-number={}", i64::MIN))
.arg("--line-increment=-1")
.pipe_in("a\n\\:\\:\nb")
.succeeds()
.stdout_is(format!("{0}\ta\n\n{0}\tb\n", i64::MIN));
}
#[test]
fn test_section_delimiter() {
for arg in ["-dabc", "--section-delimiter=abc"] {