mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge pull request #7246 from RenjiSann/printf-negative-asterisk
printf: negative asterisk param changes alignment
This commit is contained in:
commit
717a6921fc
2 changed files with 65 additions and 14 deletions
|
@ -504,6 +504,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