mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
printf: negative asterisk param changes alignement
This commit is contained in:
parent
3891ee1159
commit
707e346b84
2 changed files with 55 additions and 4 deletions
|
@ -495,6 +495,32 @@ fn sub_any_asterisk_hex_arg() {
|
|||
.stdout_only("0123456789");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sub_any_asterisk_negative_first_param() {
|
||||
new_ucmd!()
|
||||
.args(&["a(%*s)b", "-5", "xyz"])
|
||||
.succeeds()
|
||||
.stdout_only("a(xyz )b"); // Would be 'a( xyz)b' if -5 was 5
|
||||
|
||||
// Negative octal
|
||||
new_ucmd!()
|
||||
.args(&["a(%*s)b", "-010", "xyz"])
|
||||
.succeeds()
|
||||
.stdout_only("a(xyz )b");
|
||||
|
||||
// Negative hexadecimal
|
||||
new_ucmd!()
|
||||
.args(&["a(%*s)b", "-0x10", "xyz"])
|
||||
.succeeds()
|
||||
.stdout_only("a(xyz )b");
|
||||
|
||||
// Should also work on %c
|
||||
new_ucmd!()
|
||||
.args(&["a(%*c)b", "-5", "x"])
|
||||
.succeeds()
|
||||
.stdout_only("a(x )b"); // Would be 'a( x)b' if -5 was 5
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sub_any_specifiers_no_params() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue