mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
fmt: Make sure goal is always positive
A debug assertion was added to enforce "width >= goal" to catch that case before a panic in linebreak.rs. A few warnings in linebreak.rs were addressed as well, and some isize's that should always be positive (if there's no width/goal bugs) were changed to usizes to catch bugs earlier. test_fmt_width is updated to test for the same result as GNU fmt
This commit is contained in:
parent
696615099c
commit
f456b9531f
3 changed files with 25 additions and 11 deletions
|
@ -33,7 +33,19 @@ fn test_fmt_width() {
|
|||
new_ucmd!()
|
||||
.args(&["one-word-per-line.txt", param, "10"])
|
||||
.succeeds()
|
||||
.stdout_is("this is\na file\nwith one\nword per\nline\n");
|
||||
.stdout_is("this is a\nfile with\none word\nper line\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_small_width() {
|
||||
for width in ["0", "1", "2", "3"] {
|
||||
for param in ["-w", "--width"] {
|
||||
new_ucmd!()
|
||||
.args(&[param, width, "one-word-per-line.txt"])
|
||||
.succeeds()
|
||||
.stdout_is("this\nis\na\nfile\nwith\none\nword\nper\nline\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue