mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
parent
f9b4fada14
commit
a3d05e5945
2 changed files with 11 additions and 1 deletions
|
@ -239,7 +239,7 @@ fn find_kp_breakpoints<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
|
||||||
let mut next_active_breaks = vec![];
|
let mut next_active_breaks = vec![];
|
||||||
|
|
||||||
let stretch = args.opts.width - args.opts.goal;
|
let stretch = args.opts.width - args.opts.goal;
|
||||||
let minlength = args.opts.goal - stretch;
|
let minlength = args.opts.goal.max(stretch + 1) - stretch;
|
||||||
let mut new_linebreaks = vec![];
|
let mut new_linebreaks = vec![];
|
||||||
let mut is_sentence_start = false;
|
let mut is_sentence_start = false;
|
||||||
let mut least_demerits = 0;
|
let mut least_demerits = 0;
|
||||||
|
|
|
@ -156,6 +156,16 @@ fn test_fmt_too_big_goal_sometimes_okay() {
|
||||||
.stdout_is("this is a\nfile with one\nword per line\n");
|
.stdout_is("this is a\nfile with one\nword per line\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_fmt_goal_too_small_to_check_negative_minlength() {
|
||||||
|
for param in ["-g", "--goal"] {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["one-word-per-line.txt", "--width=75", param, "10"])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is("this is a file with one word per line\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fmt_non_existent_file() {
|
fn test_fmt_non_existent_file() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue