1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

uucore/format: ignore the 0 flag if a precision is specified

This commit is contained in:
Terts Diepraam 2024-02-10 12:17:31 +01:00
parent 5fbbfc75de
commit 3a21d27c1e
2 changed files with 26 additions and 6 deletions

View file

@ -1357,3 +1357,18 @@ fn precision_format() {
assert_eq!(at.read("xx 000"), generate(1, 10));
assert_eq!(at.read("xx 0x001"), generate(10, 51));
}
#[test]
fn precision_format2() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "--suffix-format", "%0#6.3x"])
.succeeds()
.stdout_only("18\n123\n");
let count = glob(&at.plus_as_string("xx*"))
.expect("there should be splits created")
.count();
assert_eq!(count, 2);
assert_eq!(at.read("xx 000"), generate(1, 10));
assert_eq!(at.read("xx 0x001"), generate(10, 51));
}