1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

printf: add tests for different octal lengths

This commit is contained in:
Joseph Jon Booker 2025-04-03 06:36:58 -05:00
parent 95e5396c4c
commit 6061b67601

View file

@ -69,6 +69,21 @@ fn escaped_octal_and_newline() {
.stdout_only("\x1F7\n");
}
#[test]
fn variable_sized_octal() {
for x in ["|\\5|", "|\\05|", "|\\005|"] {
new_ucmd!()
.arg(x)
.succeeds()
.stdout_only_bytes([b'|', 5u8, b'|']);
}
new_ucmd!()
.arg("|\\0005|")
.succeeds()
.stdout_only_bytes([b'|', 0, b'5', b'|']);
}
#[test]
fn escaped_unicode_four_digit() {
new_ucmd!().args(&["\\u0125"]).succeeds().stdout_only("ĥ");
@ -148,6 +163,21 @@ fn sub_b_string_handle_escapes() {
.stdout_only("hello \tworld");
}
#[test]
fn sub_b_string_variable_size_unicode() {
for x in ["\\5|", "\\05|", "\\005|", "\\0005|"] {
new_ucmd!()
.args(&["|%b", x])
.succeeds()
.stdout_only_bytes([b'|', 5u8, b'|']);
}
new_ucmd!()
.args(&["|%b", "\\00005|"])
.succeeds()
.stdout_only_bytes([b'|', 0, b'5', b'|']);
}
#[test]
fn sub_b_string_validate_field_params() {
new_ucmd!()