mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
seq: replace loops with a single format string
Replace two loops that print leading and trailing 0s when printing a number in fixed-width mode with a single call to `write!()` with the appropriate formatting parameters.
This commit is contained in:
parent
bfb1327ad4
commit
7ea2bfbe26
2 changed files with 17 additions and 9 deletions
|
@ -426,6 +426,15 @@ fn test_width_decimal_scientific_notation_trailing_zeros_end() {
|
|||
.no_stderr();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_width_floats() {
|
||||
new_ucmd!()
|
||||
.args(&["-w", "9.0", "10.0"])
|
||||
.succeeds()
|
||||
.stdout_is("09.0\n10.0\n")
|
||||
.no_stderr();
|
||||
}
|
||||
|
||||
// TODO This is duplicated from `test_yes.rs`; refactor them.
|
||||
/// Run `seq`, capture some of the output, close the pipe, and verify it.
|
||||
fn run(args: &[&str], expected: &[u8]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue