1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

printf: support for extract chars

Should fix tests/printf/printf-mb.sh
This commit is contained in:
Sylvestre Ledru 2025-01-01 17:17:44 +01:00 committed by Justin Tracey
parent 79cb095636
commit af577e7a14
No known key found for this signature in database
GPG key ID: 62B84F5ABDDDCE54
2 changed files with 30 additions and 7 deletions

View file

@ -1291,10 +1291,25 @@ fn float_arg_with_whitespace() {
#[test]
fn mb_input() {
for format in ["\"á", "\'á"] {
for format in ["\"á", "\'á", "'\u{e1}"] {
new_ucmd!()
.args(&["%04x\n", format])
.succeeds()
.stdout_only("00e1\n");
}
let cases = vec![
("\"á=", "="),
("\'á-", "-"),
("\'á=-==", "=-=="),
("'\u{e1}++", "++"),
];
for (format, expected) in cases {
new_ucmd!()
.args(&["%04x\n", format])
.succeeds()
.stdout_is("00e1\n")
.stderr_is(format!("printf: warning: {expected}: character(s) following character constant have been ignored\n"));
}
}