mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests/printf: support %q
This commit is contained in:
parent
e3ec12233b
commit
fb414ed917
1 changed files with 34 additions and 0 deletions
|
@ -112,6 +112,15 @@ fn sub_b_string_handle_escapes() {
|
||||||
.stdout_only("hello \tworld");
|
.stdout_only("hello \tworld");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn sub_b_string_validate_field_params() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["hello %7b", "world"])
|
||||||
|
.run()
|
||||||
|
.stdout_is("hello ")
|
||||||
|
.stderr_is("printf: %7b: invalid conversion specification\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_b_string_ignore_subs() {
|
fn sub_b_string_ignore_subs() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
@ -120,6 +129,31 @@ fn sub_b_string_ignore_subs() {
|
||||||
.stdout_only("hello world %% %i");
|
.stdout_only("hello world %% %i");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn sub_q_string_non_printable() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["non-printable: %q", "\"$test\""])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_only("non-printable: '\"$test\"'");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn sub_q_string_validate_field_params() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["hello %7q", "world"])
|
||||||
|
.run()
|
||||||
|
.stdout_is("hello ")
|
||||||
|
.stderr_is("printf: %7q: invalid conversion specification\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn sub_q_string_special_non_printable() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["non-printable: %q", "test~"])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_only("non-printable: test~");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_char() {
|
fn sub_char() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue