mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
printf: add error handling to escaped unicode characters
This commit is contained in:
parent
b10aa47e38
commit
ef7a8c300e
4 changed files with 128 additions and 28 deletions
|
@ -112,6 +112,26 @@ fn escaped_unicode_null_byte() {
|
|||
.stdout_is_bytes([1u8, b'_']);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escaped_unicode_incomplete() {
|
||||
for arg in ["\\u", "\\U", "\\uabc", "\\Uabcd"] {
|
||||
new_ucmd!()
|
||||
.arg(arg)
|
||||
.fails_with_code(1)
|
||||
.stderr_only("printf: missing hexadecimal number in escape\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escaped_unicode_invalid() {
|
||||
for arg in ["\\ud9d0", "\\U0000D8F9"] {
|
||||
new_ucmd!().arg(arg).fails_with_code(1).stderr_only(format!(
|
||||
"printf: invalid universal character name {}\n",
|
||||
arg
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escaped_percent_sign() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue