Skip to content

Commit

Permalink
tests/printf: Verify the correct error behavior of printf when provid…
Browse files Browse the repository at this point in the history
…ed with '%0c' or '%0s'
  • Loading branch information
RenjiSann committed Feb 29, 2024
1 parent 75b2bfb commit 58ee0ce
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/by-util/test_printf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,3 +765,15 @@ fn pad_string() {
.stdout_only(expected);
}
}

#[test]
fn format_spec_zero_char_fails() {
// It is invalid to have the format spec '%0c'
new_ucmd!().args(&["%0c", "3"]).fails().code_is(1);
}

#[test]
fn format_spec_zero_string_fails() {
// It is invalid to have the format spec '%0s'
new_ucmd!().args(&["%0s", "3"]).fails().code_is(1);
}

0 comments on commit 58ee0ce

Please sign in to comment.