mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57: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)
|
(0, 0.0)
|
||||||
} else {
|
} else {
|
||||||
compute_demerits(
|
compute_demerits(
|
||||||
(args.opts.goal - tlen) as isize,
|
args.opts.goal as isize - tlen as isize,
|
||||||
stretch,
|
stretch,
|
||||||
w.word_nchars as isize,
|
w.word_nchars as isize,
|
||||||
active.prev_rat,
|
active.prev_rat,
|
||||||
|
|
|
@ -33,18 +33,16 @@ fn test_fmt_w_too_big() {
|
||||||
"fmt: error: invalid width: '2501': Numerical result out of range"
|
"fmt: error: invalid width: '2501': Numerical result out of range"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/* #[test]
|
#[test]
|
||||||
Fails for now, see https://github.com/uutils/coreutils/issues/1501
|
|
||||||
fn test_fmt_w() {
|
fn test_fmt_w() {
|
||||||
let result = new_ucmd!()
|
let result = new_ucmd!()
|
||||||
.arg("-w")
|
.arg("-w")
|
||||||
.arg("10")
|
.arg("10")
|
||||||
.arg("one-word-per-line.txt")
|
.arg("one-word-per-line.txt")
|
||||||
.run();
|
.run();
|
||||||
//.stdout_is_fixture("call_graph.expected");
|
//.stdout_is_fixture("call_graph.expected");
|
||||||
assert_eq!(result.stdout_str().trim(), "this is a file with one word per line");
|
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