1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 03:26:18 +00:00

Merge pull request #5958 from tertsdiepraam/csplit-printf

`csplit`: use `printf` functionality from `uucore`
This commit is contained in:
Daniel Hofstetter 2024-02-16 14:39:03 +01:00 committed by GitHub
commit 420dfe8a9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 123 additions and 154 deletions

View file

@ -1342,3 +1342,20 @@ fn test_line_num_range_with_up_to_match3() {
assert_eq!(at.read("xx01"), "");
assert_eq!(at.read("xx02"), generate(10, 51));
}
#[test]
fn precision_format() {
for f in ["%#6.3x", "%0#6.3x"] {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "--suffix-format", f])
.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));
}
}