mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fix fmt crashing on subtracting unsigned numbers (#2178)
This commit is contained in:
parent
7d2b051866
commit
a2658250fc
2 changed files with 7 additions and 9 deletions
|
@ -296,7 +296,7 @@ fn find_kp_breakpoints<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
|
|||
(0, 0.0)
|
||||
} else {
|
||||
compute_demerits(
|
||||
(args.opts.goal - tlen) as isize,
|
||||
args.opts.goal as isize - tlen as isize,
|
||||
stretch,
|
||||
w.word_nchars as isize,
|
||||
active.prev_rat,
|
||||
|
|
|
@ -33,18 +33,16 @@ fn test_fmt_w_too_big() {
|
|||
"fmt: error: invalid width: '2501': Numerical result out of range"
|
||||
);
|
||||
}
|
||||
/* #[test]
|
||||
Fails for now, see https://github.com/uutils/coreutils/issues/1501
|
||||
#[test]
|
||||
fn test_fmt_w() {
|
||||
let result = new_ucmd!()
|
||||
.arg("-w")
|
||||
.arg("10")
|
||||
.arg("one-word-per-line.txt")
|
||||
.run();
|
||||
//.stdout_is_fixture("call_graph.expected");
|
||||
assert_eq!(result.stdout_str().trim(), "this is a file with one word per line");
|
||||
//.stdout_is_fixture("call_graph.expected");
|
||||
assert_eq!(
|
||||
result.stdout_str().trim(),
|
||||
"this is\na file\nwith one\nword per\nline"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
fmt is pretty broken in general, needs more works to have more tests
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue