mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
printf: add tests for different octal lengths
This commit is contained in:
@@ -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!()
|
||||
|
||||
Reference in New Issue
Block a user