mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
printf: Change get_char and write_padded to handle bytes instead of chars
This commit is contained in:
parent
5d74a6e002
commit
42cde767d2
3 changed files with 23 additions and 28 deletions
|
@ -743,12 +743,7 @@ fn pad_unsigned_three() {
|
|||
|
||||
#[test]
|
||||
fn pad_char() {
|
||||
for (format, expected) in [
|
||||
("%3c", " X"),
|
||||
("%1c", "X"),
|
||||
("%-1c", "X"),
|
||||
("%-3c", "X "),
|
||||
] {
|
||||
for (format, expected) in [("%3c", " X"), ("%1c", "X"), ("%-1c", "X"), ("%-3c", "X ")] {
|
||||
new_ucmd!()
|
||||
.args(&[format, "X"])
|
||||
.succeeds()
|
||||
|
@ -756,18 +751,17 @@ fn pad_char() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn pad_string() {
|
||||
for (format, expected) in [
|
||||
("%8s", " bottle"),
|
||||
("%-8s", "bottle "),
|
||||
("%6s", "bottle"),
|
||||
("%-6s", "bottle"),
|
||||
("%8s", " bottle"),
|
||||
("%-8s", "bottle "),
|
||||
("%6s", "bottle"),
|
||||
("%-6s", "bottle"),
|
||||
] {
|
||||
new_ucmd!()
|
||||
.args(&[format, "bottle"])
|
||||
.succeeds()
|
||||
.stdout_only(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue