Ben Wiederhake
a53ec17b67
numfmt+tests: remove unused spell-checker:disable
2024-04-30 18:28:20 +02:00
Ben Wiederhake
2646944bee
numfmt: accept shortcuts for stringly-enum arguments
2024-04-14 15:39:46 +02:00
Ben Wiederhake
44c59a6d28
numfmt: don't flake even on exotic pipe buffer sizes
2024-02-23 05:42:29 +01:00
Sylvestre Ledru
bfca6bf70f
Add license headers on all files
2023-08-21 10:49:27 +02:00
sbentmar
42bf580f13
numfmt: add --invalid option ( #4249 )
...
* numfmt: add invalid option
* numfmt: return code 0 if ignore or warn
* numfmt: implement all --invalid modes
* numfmt: validate stdout and stderr
* numfmt: remove unnecessary code
* numfmt: apply formatting
* numfmt: fix clippy issues
* numfmt: fix failing test cases
* numfmt: fix formatting
* numfmt: fix bug when handling broken pipe
* numfmt: fix bug where extra newline was added
* numfmt: add test cases for edge cases
* numfmt: simplify error handling
* numfmt: remove redundant if
* numfmt: add newline between functions
* numfmt: fix failing test cases
* numfmt: add support for arg numbers using --invalid
* numfmt: simplify error handling in value handlers
* numfmt: fix merge conflict and align prints
* numfmt: fix clippy suggestion
* numfmt: replace "valid" with "invalid" in tests
* numfmt: move INVALID to respect alph. order
* numfmt: move printlns outside of match to avoid duplication
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
* numfmt: remove empty line
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2023-07-01 17:08:12 +02:00
Daniel Hofstetter
6988eb7ec6
tests: expand wildcard imports
2023-03-20 15:32:35 +01:00
Daniel Hofstetter
f6b646e4e5
clippy: fix warnings introduced with Rust 1.67.0
2023-01-27 17:37:56 +01:00
Joining7943
1fadeb43b2
tests/util: Do not trim stderr in CmdResult::stderr_is. Add method stderr_trimmed_is.
...
Fix tests assert whitespace instead of trimming it. Disable some tests in `test_tr` because `tr`
produces too many newlines.
2023-01-22 14:56:19 +01:00
Daniel Hofstetter
2d4810b91b
numfmt: allow ' ' as field separator
2022-11-01 10:04:46 +01:00
Daniel Hofstetter
27c233f294
numfmt: allow "-" in field list
2022-10-31 14:53:41 +01:00
Daniel Hofstetter
5d27c19853
numfmt: add test for "--field -" (all fields)
2022-10-31 09:26:28 +01:00
Daniel Hofstetter
3a8feedf2d
numfmt: allow hyphen values for --field option
2022-10-29 16:50:41 +02:00
Daniel Hofstetter
2eb0b6dfe0
numfmt: round values if precision is 0
2022-10-27 15:33:20 +02:00
Daniel Hofstetter
dedb6289dd
numfmt: handle negative zero values
2022-10-24 15:13:02 +02:00
Terts Diepraam
9177cb7b24
all: add tests for usage error exit code
2022-09-10 20:59:42 +02:00
Daniel Hofstetter
e642ca90dd
numfmt: preserve trailing zeros
2022-08-01 09:48:13 +02:00
Daniel Hofstetter
ee13bc41e7
numfmt: implement --format
2022-07-28 09:59:30 +02:00
Daniel Hofstetter
34b4853890
numfmt: don't round floats if --from is "none"
2022-07-24 16:25:52 +02:00
Daniel Hofstetter
29c4d08ee9
numfmt: enable ignored test
2022-07-21 13:20:42 +02:00
Daniel Hofstetter
74bd9a26d6
numfmt: show "invalid suffix" error for "i" suffix
2022-07-20 17:51:36 +02:00
Daniel Hofstetter
9e44acf307
numfmt: reject suffix if unit is "none"
2022-07-13 10:47:59 +02:00
Daniel Hofstetter
aef24db90f
numfmt: show error if "i" suffix is missing
2022-07-12 10:58:07 +02:00
Daniel Hofstetter
1f292dd834
numfmt: implement "--to-unit" & "--from-unit"
2022-07-09 08:01:27 +02:00
Daniel Hofstetter
220c3ca4fb
numfmt: show error if --padding is zero
2022-07-01 13:34:05 +02:00
Terts Diepraam
18369dc0be
all: use array intoiterator
2022-04-05 10:39:31 +02:00
sbentmar
413bff26f8
numfmt: ignore stdin write error
2022-01-17 16:24:40 +01:00
sbentmar
328cf4d91b
numfmt: add more negative tests
2022-01-17 16:24:40 +01:00
Sebastian Holgersson
9b04c98ddb
numfmt: use UResult in more functions
...
This commit replaces generic Results with UResults in some key
functions in numfmt. As a result of this, we can provide different
exit codes for different errors, which resolves ~70 failing test
cases in the GNU numfmt.pl test suite.
2022-01-17 16:24:40 +01:00
Sebastian Holgersson
84798a520e
numfmt: fix spelling and formatting issues in tests
2022-01-01 22:55:50 +01:00
Sebastian Holgersson
af5919e466
numfmt: implement missing --suffix option
...
adds support for the --suffix option from issue #1280 .
2022-01-01 21:57:23 +01:00
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