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

Merge branch 'main' into printf-rewrite

This commit is contained in:
Terts Diepraam 2023-11-20 13:53:11 +01:00
commit 6d2698b802
179 changed files with 2883 additions and 2016 deletions

View file

@ -112,6 +112,15 @@ fn sub_b_string_handle_escapes() {
.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]
fn sub_b_string_ignore_subs() {
new_ucmd!()
@ -120,6 +129,31 @@ fn sub_b_string_ignore_subs() {
.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]
fn sub_char() {
new_ucmd!()
@ -229,6 +263,14 @@ fn sub_num_hex_upper() {
.stdout_only("thirty in hex is 1E");
}
#[test]
fn sub_num_hex_non_numerical() {
new_ucmd!()
.args(&["parameters need to be numbers %X", "%194"])
.fails()
.code_is(1);
}
#[test]
fn sub_num_float() {
new_ucmd!()