mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Use the new function fails_with_code
Done with ``` $ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs $ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs $ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs $ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs ... ```
This commit is contained in:
parent
76ad6042b5
commit
18cb7dcf9e
90 changed files with 448 additions and 732 deletions
|
@ -50,8 +50,7 @@ fn escaped_hex() {
|
|||
fn test_missing_escaped_hex_value() {
|
||||
new_ucmd!()
|
||||
.arg(r"\x")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_only("printf: missing hexadecimal number in escape\n");
|
||||
}
|
||||
|
||||
|
@ -289,8 +288,7 @@ fn sub_num_hex_upper() {
|
|||
fn sub_num_hex_non_numerical() {
|
||||
new_ucmd!()
|
||||
.args(&["parameters need to be numbers %X", "%194"])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
.fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -640,8 +638,7 @@ fn sub_general_round_float_leading_zeroes() {
|
|||
fn partial_float() {
|
||||
new_ucmd!()
|
||||
.args(&["%.2f is %s", "42.03x", "a lot"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stdout_is("42.03 is a lot")
|
||||
.stderr_is("printf: '42.03x': value not completely converted\n");
|
||||
}
|
||||
|
@ -650,8 +647,7 @@ fn partial_float() {
|
|||
fn partial_integer() {
|
||||
new_ucmd!()
|
||||
.args(&["%d is %s", "42x23", "a lot"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stdout_is("42 is a lot")
|
||||
.stderr_is("printf: '42x23': value not completely converted\n");
|
||||
}
|
||||
|
@ -660,8 +656,7 @@ fn partial_integer() {
|
|||
fn test_overflow() {
|
||||
new_ucmd!()
|
||||
.args(&["%d", "36893488147419103232"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_is("printf: '36893488147419103232': Numerical result out of range\n");
|
||||
}
|
||||
|
||||
|
@ -669,8 +664,7 @@ fn test_overflow() {
|
|||
fn partial_char() {
|
||||
new_ucmd!()
|
||||
.args(&["%d", "'abc"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stdout_is("97")
|
||||
.stderr_is(
|
||||
"printf: warning: bc: character(s) following character constant have been ignored\n",
|
||||
|
@ -805,13 +799,13 @@ fn pad_string() {
|
|||
#[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);
|
||||
new_ucmd!().args(&["%0c", "3"]).fails_with_code(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);
|
||||
new_ucmd!().args(&["%0s", "3"]).fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue