mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
numfmt: apply prefix after scaling for --to-unit (#11684)
* numfmt: apply suffix after scaling * test_numfmt: remove ignore from prefix selection test
This commit is contained in:
@@ -487,8 +487,8 @@ fn transform_to(
|
||||
precision: usize,
|
||||
unit_separator: &str,
|
||||
) -> Result<String> {
|
||||
let (i2, s) = consider_suffix(s, opts.to, round_method, precision)?;
|
||||
let i2 = i2 / (opts.to_unit as f64);
|
||||
let i2 = s / (opts.to_unit as f64);
|
||||
let (i2, s) = consider_suffix(i2, opts.to, round_method, precision)?;
|
||||
Ok(match s {
|
||||
None => {
|
||||
format!(
|
||||
|
||||
@@ -1436,12 +1436,8 @@ fn test_zero_pad_sign_order_issue_11664() {
|
||||
.stdout_is("-00000009869647.00\n");
|
||||
}
|
||||
|
||||
// https://github.com/uutils/coreutils/issues/11666
|
||||
// `--to-unit=N` selects the output prefix based on the unscaled value
|
||||
// instead of `value / N`.
|
||||
#[test]
|
||||
#[ignore = "GNU compat: see uutils/coreutils#11666"]
|
||||
fn test_to_unit_prefix_selection_issue_11666() {
|
||||
fn test_to_unit_prefix_selection() {
|
||||
new_ucmd!()
|
||||
.args(&["--to=iec-i", "--to-unit=885", "100000"])
|
||||
.succeeds()
|
||||
|
||||
Reference in New Issue
Block a user