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

csplit: fix up tests and error message for filenames

This commit is contained in:
Terts Diepraam 2024-02-10 21:43:52 +01:00
parent 50cab572db
commit fc82360f58
2 changed files with 23 additions and 33 deletions

View file

@ -1345,30 +1345,17 @@ fn test_line_num_range_with_up_to_match3() {
#[test]
fn precision_format() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "--suffix-format", "%#6.3x"])
.succeeds()
.stdout_only("18\n123\n");
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));
}
#[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));
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));
}
}