From 5fbbfc75de5778f36917a1702b900a6522029ad6 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 10 Feb 2024 11:59:41 +0100 Subject: [PATCH] csplit: add test for precision syntax --- tests/by-util/test_csplit.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/by-util/test_csplit.rs b/tests/by-util/test_csplit.rs index b83d5e0ee..d4b521660 100644 --- a/tests/by-util/test_csplit.rs +++ b/tests/by-util/test_csplit.rs @@ -1342,3 +1342,18 @@ 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() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "--suffix-format", "%#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)); +}