Commit graph

10 commits

Author SHA1 Message Date
Terts Diepraam
3086e95702 numfmt: add round and use C locale style for errors 2021-06-20 00:21:14 +02:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Sylvestre Ledru
95092e6440 ignore test_should_calculate_implicit_padding_per_free_argument
Fails from time to time with
```
---- test_numfmt::test_should_calculate_implicit_padding_per_free_argument stdout ----
current_directory_resolved:
run: /target/x86_64-unknown-linux-musl/debug/coreutils numfmt --from=auto    1Ki         2K
thread 'test_numfmt::test_should_calculate_implicit_padding_per_free_argument' panicked at 'failed to write to stdin of child: Broken pipe (os error 32)', tests/common/util.rs:859:21
```
2021-05-23 00:34:01 +02:00
Daniel Rocco
52f2ab6898 numfmt: implement --delimiter
closes #1454
2021-03-15 11:55:56 -04:00
Daniel Rocco
0e02607dc7 numfmt: implement --field 2021-03-08 10:53:34 -05:00
Daniel Rocco
d06f91fbe2
numfmt: align format output values with GNU (#1745)
When converting to SI or IEC, produce values that align with the conventions
used by GNU numfmt.

- values > 10 are represented without a decimal place, so 10000 becomes 10K
  instead of 10.0K

- when truncating, take the ceiling of the value, so 100001 becomes 101K

- values < 10 are truncated to the highest tenth, so 1001 becomes 1.1K

closes #1726
2021-03-06 18:26:05 +01:00
Sylvestre Ledru
c06967a45a rustfmt two files 2021-02-23 20:56:41 +01:00
Daniel Rocco
f595164063 numfmt: prohibit --header=0 to align with GNU
Adjust header option handling to prohibit passing a value of 0 to align
with GNU numfmt. Also report header option parse errors as GNU does.

closes #1708
2021-02-15 08:14:44 +01:00
Daniel Rocco
f8006f47df
numfmt: handle leading whitespace & implied padding (#1721)
Align with GNU numfmt by trimming leading whitespace from supplied values.
If the user did not specify a padding, calculate an implied padding from
the leading whitespace and the value.

Also track closer to GNU numfmt’s error message format.
2021-02-14 09:04:29 +01:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_numfmt.rs (Browse further)