mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
numfmt: preserve trailing zeros
This commit is contained in:
parent
38679f1c1b
commit
e642ca90dd
3 changed files with 63 additions and 8 deletions
|
@ -10,6 +10,14 @@ fn test_should_not_round_floats() {
|
|||
.stdout_is("0.99\n1.01\n1.1\n1.22\n0.1\n-0.1\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_preserve_trailing_zeros() {
|
||||
new_ucmd!()
|
||||
.args(&["0.1000", "10.00"])
|
||||
.succeeds()
|
||||
.stdout_is("0.1000\n10.00\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_si() {
|
||||
new_ucmd!()
|
||||
|
@ -823,6 +831,18 @@ fn test_format_with_precision_and_to_arg() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_format_preserve_trailing_zeros_if_no_precision_is_specified() {
|
||||
let values = vec!["10.0", "0.0100"];
|
||||
|
||||
for value in values {
|
||||
new_ucmd!()
|
||||
.args(&["--format=%f", value])
|
||||
.succeeds()
|
||||
.stdout_is(format!("{}\n", value));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_format_without_percentage_directive() {
|
||||
let invalid_formats = vec!["", "hello"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue