mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
printf: add tests for different octal lengths
This commit is contained in:
parent
95e5396c4c
commit
6061b67601
1 changed files with 30 additions and 0 deletions
|
@ -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!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue