Commit Graph
29 Commits
Author SHA1 Message Date
karanabeandDaniel Hofstetter c138b386ed fmt: fix width wrapping for GNU compatibility
Align fmt line-breaking with GNU coreutils 9.10 for the
tests/fmt/width case. The -w 7 input "aa bb cc dd ee" now
breaks as:
  aa
  bb cc
  dd ee

Update Knuth-Plass scoring to keep finite penalties,
evaluate break-before candidates, and apply orphan penalties.
Add a regression test for -w 7 and -w 8 behavior.
2026-02-24 11:31:17 +01:00
574f6ba2ef fmt : handle invalid UTF-8 input by replacing malformed sequences (#9329)
---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-01-13 22:17:38 +01:00
Sylvestre Ledru 3ed1f47de3 add more emoji tests 2025-09-03 22:39:21 +02:00
Sylvestre Ledru 89f434d2bc Fix fmt to handle non-UTF-8 filenames 2025-08-14 10:52:24 +02:00
Dorian Peron 6e23d4e979 tests: patch tests to simplify imports 2025-07-01 03:36:46 +02:00
Sylvestre Ledru 2df7f01c15 fmt: fix the last two gnu issues 2025-06-30 00:06:52 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Sylvestre Ledru ab77eaea45 fmt: generate an error if the input is a directory
tested by tests/misc/read-errors
2024-11-16 19:49:44 +01:00
Ben Wiederhake ea18cfd3d8 fmt: fix error priority, make goal-errors more helpful 2024-05-06 19:36:39 +02:00
ahmadabdandBen Wiederhake a3d05e5945 fmt: value of minlength should not be negative
closes #6354
2024-05-05 21:08:38 +02:00
Ben Wiederhake a13949b4ba fmt: add basic tests for split-only, prefix, and skip-prefix args 2024-05-05 17:03:28 +02:00
Ben Wiederhake e76f92c212 fmt: accept repeated arguments 2024-05-05 16:13:46 +02:00
Joseph Jon Booker 7b928f792c fmt: allow negative widths as first argument
Also fix error messages for consistency with GNU fmt
2024-03-24 20:59:53 -05:00
Daniel Hofstetter 3ad226cf54 fmt: show error if goal > default width 2024-03-20 10:26:11 +01:00
Joseph Jon Booker f456b9531f 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
2024-03-19 08:52:04 -05:00
Daniel Hofstetter 51eb20a15d fmt: use clap's value parser for goal & width 2023-09-28 10:50:56 +02:00
Sylvestre Ledru bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Bluelief a7ab660a38 fmt: change test to ignore and fix test output
- fix test to get same result as GNU fmt
2023-08-15 00:43:32 +09:00
Bluelief 946e1bb2d1 fmt: fix panic on width argument 2023-08-14 22:47:21 +09:00
Daniel Hofstetter 72041568e7 fmt: cleanup tests 2023-04-20 15:22:26 +02:00
Daniel Hofstetter 6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Terts Diepraam 9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Yağız can Değirmenci 071899d24d tests: delete 'error:' prefix from the tests 2021-05-26 02:45:53 +03:00
jaggededgedjusticeandGitHub a2658250fc Fix fmt crashing on subtracting unsigned numbers (#2178) 2021-05-05 23:12:17 +02:00