When parsing integers, we should still return the min/max value
of the type (depending on the type), and wrap that in the error.
We need to refactor the map function to handle this case better,
and add an extract function to get the value out of an error
(if any).
This fixes the integer part of #7508.
After scratching my head a bit about why the hexadecimal code works,
seems better to do make scale an u64 to clarify.
Note that this may u64 may exceed i64 capacity, but that can only
happen if the number of digits provided > 2**63 (impossible).
Parse numbers like 123.15e15 and 0xfp-2, and add some tests
for that.
`parse` is becoming more and more of a monster: we should consider
splitting it into multiple parts.
Fixes#7474.
Large numbers can overflow u64 when doing 16u64.pow(scale):
do the operation on BigInt/BigDecimal instead.
Also, add a test. Wolfram Alpha can help confirm the decimal number
is correct (16-16**-21).
Leading plus signs are allowed for all formats.
Add tests (including some tests for negative i64 values, and mixed
case special values that springed to mind).
Fixes#7473.
We call the function extended_parse, so that we do not clash
with other parsing functions in other traits.
- Also implement parser for ExtendedBigDecimal (straightforward).
- Base doesn't need to be public anymore.
- Rename the error to ExtendedParserError.
Update sum to properly propagate errors from file-reads,
including implementing a retry on ErrorKind::Interrupted.
Also switch to using writeln! rather than println! to prevent
crashes if stdout is directed to /dev/full
* Fixes#7558 Added check to only insert addition double hyphen if at start of arguments to correctly prepend addition hyphens for clap as well as additional test case
* additional comment
* fixes issue where flags precedes "--" as arguments
All the other tests directly called format_float_* functions,
bypassing the additional logic in `fmt` (negative numbers, padding,
etc.).
This also tests the `parse` function in `mod.rs`, which calls back
into `try_from_spec` here. This also makes it easier to test a lot
of different format combinations without having to do end-to-end
tests in `test_printf.rs`.
Also add broken tests for the issues in #7509 and #7510.
chcon/runcon rely on the selinux crate, that is empty on
non-Linux platforms.
This doesn't matter for normal builds that use the default features
for the platform (explicitly trying to build them will fail though).
This is a problem when using `cargo test --workspace` though,
as that tries to build all packages, including uu_chcon/uu_runcon.
Just prevent compilation of these source files when target_os != linux.