tests/seq: use stdout_only() to remove no_stderr()

This commit is contained in:
Daniel Hofstetter 2024-12-07 16:59:13 +01:00
parent 367cc19d45
commit e654645974

View file

@ -303,18 +303,15 @@ fn test_preserve_negative_zero_start() {
new_ucmd!() new_ucmd!()
.args(&["-0", "1"]) .args(&["-0", "1"])
.succeeds() .succeeds()
.stdout_is("-0\n1\n") .stdout_only("-0\n1\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-0", "1", "2"]) .args(&["-0", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-0\n1\n2\n") .stdout_only("-0\n1\n2\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-0", "1", "2.0"]) .args(&["-0", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0\n1\n2\n") .stdout_only("-0\n1\n2\n");
.no_stderr();
} }
#[test] #[test]
@ -322,8 +319,7 @@ fn test_drop_negative_zero_end() {
new_ucmd!() new_ucmd!()
.args(&["1", "-1", "-0"]) .args(&["1", "-1", "-0"])
.succeeds() .succeeds()
.stdout_is("1\n0\n") .stdout_only("1\n0\n");
.no_stderr();
} }
#[test] #[test]
@ -331,13 +327,11 @@ fn test_width_scientific_notation() {
new_ucmd!() new_ucmd!()
.args(&["-w", "999", "1e3"]) .args(&["-w", "999", "1e3"])
.succeeds() .succeeds()
.stdout_is("0999\n1000\n") .stdout_only("0999\n1000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "999", "1E3"]) .args(&["-w", "999", "1E3"])
.succeeds() .succeeds()
.stdout_is("0999\n1000\n") .stdout_only("0999\n1000\n");
.no_stderr();
} }
#[test] #[test]
@ -345,18 +339,15 @@ fn test_width_negative_zero() {
new_ucmd!() new_ucmd!()
.args(&["-w", "-0", "1"]) .args(&["-w", "-0", "1"])
.succeeds() .succeeds()
.stdout_is("-0\n01\n") .stdout_only("-0\n01\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0", "1", "2"]) .args(&["-w", "-0", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-0\n01\n02\n") .stdout_only("-0\n01\n02\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0", "1", "2.0"]) .args(&["-w", "-0", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0\n01\n02\n") .stdout_only("-0\n01\n02\n");
.no_stderr();
} }
#[test] #[test]
@ -364,33 +355,27 @@ fn test_width_negative_zero_decimal_notation() {
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.0", "1"]) .args(&["-w", "-0.0", "1"])
.succeeds() .succeeds()
.stdout_is("-0.0\n01.0\n") .stdout_only("-0.0\n01.0\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.0", "1.0"]) .args(&["-w", "-0.0", "1.0"])
.succeeds() .succeeds()
.stdout_is("-0.0\n01.0\n") .stdout_only("-0.0\n01.0\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.0", "1", "2"]) .args(&["-w", "-0.0", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-0.0\n01.0\n02.0\n") .stdout_only("-0.0\n01.0\n02.0\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.0", "1", "2.0"]) .args(&["-w", "-0.0", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0.0\n01.0\n02.0\n") .stdout_only("-0.0\n01.0\n02.0\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.0", "1.0", "2"]) .args(&["-w", "-0.0", "1.0", "2"])
.succeeds() .succeeds()
.stdout_is("-0.0\n01.0\n02.0\n") .stdout_only("-0.0\n01.0\n02.0\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.0", "1.0", "2.0"]) .args(&["-w", "-0.0", "1.0", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0.0\n01.0\n02.0\n") .stdout_only("-0.0\n01.0\n02.0\n");
.no_stderr();
} }
#[test] #[test]
@ -398,98 +383,80 @@ fn test_width_negative_zero_scientific_notation() {
new_ucmd!() new_ucmd!()
.args(&["-w", "-0e0", "1"]) .args(&["-w", "-0e0", "1"])
.succeeds() .succeeds()
.stdout_is("-0\n01\n") .stdout_only("-0\n01\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0e0", "1", "2"]) .args(&["-w", "-0e0", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-0\n01\n02\n") .stdout_only("-0\n01\n02\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0e0", "1", "2.0"]) .args(&["-w", "-0e0", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0\n01\n02\n") .stdout_only("-0\n01\n02\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0e+1", "1"]) .args(&["-w", "-0e+1", "1"])
.succeeds() .succeeds()
.stdout_is("-00\n001\n") .stdout_only("-00\n001\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0e+1", "1", "2"]) .args(&["-w", "-0e+1", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-00\n001\n002\n") .stdout_only("-00\n001\n002\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0e+1", "1", "2.0"]) .args(&["-w", "-0e+1", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-00\n001\n002\n") .stdout_only("-00\n001\n002\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e0", "1"]) .args(&["-w", "-0.000e0", "1"])
.succeeds() .succeeds()
.stdout_is("-0.000\n01.000\n") .stdout_only("-0.000\n01.000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e0", "1", "2"]) .args(&["-w", "-0.000e0", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-0.000\n01.000\n02.000\n") .stdout_only("-0.000\n01.000\n02.000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e0", "1", "2.0"]) .args(&["-w", "-0.000e0", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0.000\n01.000\n02.000\n") .stdout_only("-0.000\n01.000\n02.000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e-2", "1"]) .args(&["-w", "-0.000e-2", "1"])
.succeeds() .succeeds()
.stdout_is("-0.00000\n01.00000\n") .stdout_only("-0.00000\n01.00000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e-2", "1", "2"]) .args(&["-w", "-0.000e-2", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-0.00000\n01.00000\n02.00000\n") .stdout_only("-0.00000\n01.00000\n02.00000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e-2", "1", "2.0"]) .args(&["-w", "-0.000e-2", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-0.00000\n01.00000\n02.00000\n") .stdout_only("-0.00000\n01.00000\n02.00000\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e5", "1"]) .args(&["-w", "-0.000e5", "1"])
.succeeds() .succeeds()
.stdout_is("-000000\n0000001\n") .stdout_only("-000000\n0000001\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e5", "1", "2"]) .args(&["-w", "-0.000e5", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-000000\n0000001\n0000002\n") .stdout_only("-000000\n0000001\n0000002\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e5", "1", "2.0"]) .args(&["-w", "-0.000e5", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-000000\n0000001\n0000002\n") .stdout_only("-000000\n0000001\n0000002\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e5", "1"]) .args(&["-w", "-0.000e5", "1"])
.succeeds() .succeeds()
.stdout_is("-000000\n0000001\n") .stdout_only("-000000\n0000001\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e5", "1", "2"]) .args(&["-w", "-0.000e5", "1", "2"])
.succeeds() .succeeds()
.stdout_is("-000000\n0000001\n0000002\n") .stdout_only("-000000\n0000001\n0000002\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.000e5", "1", "2.0"]) .args(&["-w", "-0.000e5", "1", "2.0"])
.succeeds() .succeeds()
.stdout_is("-000000\n0000001\n0000002\n") .stdout_only("-000000\n0000001\n0000002\n");
.no_stderr();
} }
#[test] #[test]
@ -497,14 +464,12 @@ fn test_width_decimal_scientific_notation_increment() {
new_ucmd!() new_ucmd!()
.args(&["-w", ".1", "1e-2", ".11"]) .args(&["-w", ".1", "1e-2", ".11"])
.succeeds() .succeeds()
.stdout_is("0.10\n0.11\n") .stdout_only("0.10\n0.11\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", ".0", "1.500e-1", ".2"]) .args(&["-w", ".0", "1.500e-1", ".2"])
.succeeds() .succeeds()
.stdout_is("0.0000\n0.1500\n") .stdout_only("0.0000\n0.1500\n");
.no_stderr();
} }
/// Test that trailing zeros in the start argument contribute to precision. /// Test that trailing zeros in the start argument contribute to precision.
@ -513,8 +478,7 @@ fn test_width_decimal_scientific_notation_trailing_zeros_start() {
new_ucmd!() new_ucmd!()
.args(&["-w", ".1000", "1e-2", ".11"]) .args(&["-w", ".1000", "1e-2", ".11"])
.succeeds() .succeeds()
.stdout_is("0.1000\n0.1100\n") .stdout_only("0.1000\n0.1100\n");
.no_stderr();
} }
/// Test that trailing zeros in the increment argument contribute to precision. /// Test that trailing zeros in the increment argument contribute to precision.
@ -523,8 +487,7 @@ fn test_width_decimal_scientific_notation_trailing_zeros_increment() {
new_ucmd!() new_ucmd!()
.args(&["-w", "1e-1", "0.0100", ".11"]) .args(&["-w", "1e-1", "0.0100", ".11"])
.succeeds() .succeeds()
.stdout_is("0.1000\n0.1100\n") .stdout_only("0.1000\n0.1100\n");
.no_stderr();
} }
#[test] #[test]
@ -532,8 +495,7 @@ fn test_width_negative_decimal_notation() {
new_ucmd!() new_ucmd!()
.args(&["-w", "-.1", ".1", ".11"]) .args(&["-w", "-.1", ".1", ".11"])
.succeeds() .succeeds()
.stdout_is("-0.1\n00.0\n00.1\n") .stdout_only("-0.1\n00.0\n00.1\n");
.no_stderr();
} }
#[test] #[test]
@ -541,22 +503,19 @@ fn test_width_negative_scientific_notation() {
new_ucmd!() new_ucmd!()
.args(&["-w", "-1e-3", "1"]) .args(&["-w", "-1e-3", "1"])
.succeeds() .succeeds()
.stdout_is("-0.001\n00.999\n") .stdout_only("-0.001\n00.999\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-1.e-3", "1"]) .args(&["-w", "-1.e-3", "1"])
.succeeds() .succeeds()
.stdout_is("-0.001\n00.999\n") .stdout_only("-0.001\n00.999\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-1.0e-4", "1"]) .args(&["-w", "-1.0e-4", "1"])
.succeeds() .succeeds()
.stdout_is("-0.00010\n00.99990\n") .stdout_only("-0.00010\n00.99990\n");
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-.1e2", "10", "100"]) .args(&["-w", "-.1e2", "10", "100"])
.succeeds() .succeeds()
.stdout_is( .stdout_only(
"-010 "-010
0000 0000
0010 0010
@ -570,12 +529,11 @@ fn test_width_negative_scientific_notation() {
0090 0090
0100 0100
", ",
) );
.no_stderr();
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.1e2", "10", "100"]) .args(&["-w", "-0.1e2", "10", "100"])
.succeeds() .succeeds()
.stdout_is( .stdout_only(
"-010 "-010
0000 0000
0010 0010
@ -589,8 +547,7 @@ fn test_width_negative_scientific_notation() {
0090 0090
0100 0100
", ",
) );
.no_stderr();
} }
/// Test that trailing zeros in the end argument do not contribute to width. /// Test that trailing zeros in the end argument do not contribute to width.
@ -599,8 +556,7 @@ fn test_width_decimal_scientific_notation_trailing_zeros_end() {
new_ucmd!() new_ucmd!()
.args(&["-w", "1e-1", "1e-2", ".1100"]) .args(&["-w", "1e-1", "1e-2", ".1100"])
.succeeds() .succeeds()
.stdout_is("0.10\n0.11\n") .stdout_only("0.10\n0.11\n");
.no_stderr();
} }
#[test] #[test]
@ -608,8 +564,7 @@ fn test_width_floats() {
new_ucmd!() new_ucmd!()
.args(&["-w", "9.0", "10.0"]) .args(&["-w", "9.0", "10.0"])
.succeeds() .succeeds()
.stdout_is("09.0\n10.0\n") .stdout_only("09.0\n10.0\n");
.no_stderr();
} }
// TODO This is duplicated from `test_yes.rs`; refactor them. // TODO This is duplicated from `test_yes.rs`; refactor them.
@ -661,11 +616,7 @@ fn test_neg_inf_width() {
#[test] #[test]
fn test_ignore_leading_whitespace() { fn test_ignore_leading_whitespace() {
new_ucmd!() new_ucmd!().arg(" 1").succeeds().stdout_only("1\n");
.arg(" 1")
.succeeds()
.stdout_is("1\n")
.no_stderr();
} }
#[test] #[test]
@ -684,8 +635,7 @@ fn test_negative_zero_int_start_float_increment() {
new_ucmd!() new_ucmd!()
.args(&["-0", "0.1", "0.1"]) .args(&["-0", "0.1", "0.1"])
.succeeds() .succeeds()
.stdout_is("-0.0\n0.1\n") .stdout_only("-0.0\n0.1\n");
.no_stderr();
} }
#[test] #[test]
@ -693,7 +643,7 @@ fn test_float_precision_increment() {
new_ucmd!() new_ucmd!()
.args(&["999", "0.1", "1000.1"]) .args(&["999", "0.1", "1000.1"])
.succeeds() .succeeds()
.stdout_is( .stdout_only(
"999.0 "999.0
999.1 999.1
999.2 999.2
@ -707,8 +657,7 @@ fn test_float_precision_increment() {
1000.0 1000.0
1000.1 1000.1
", ",
) );
.no_stderr();
} }
/// Test for floating point precision issues. /// Test for floating point precision issues.
@ -717,8 +666,7 @@ fn test_negative_increment_decimal() {
new_ucmd!() new_ucmd!()
.args(&["0.1", "-0.1", "-0.2"]) .args(&["0.1", "-0.1", "-0.2"])
.succeeds() .succeeds()
.stdout_is("0.1\n0.0\n-0.1\n-0.2\n") .stdout_only("0.1\n0.0\n-0.1\n-0.2\n");
.no_stderr();
} }
#[test] #[test]
@ -726,8 +674,7 @@ fn test_zero_not_first() {
new_ucmd!() new_ucmd!()
.args(&["-w", "-0.1", "0.1", "0.1"]) .args(&["-w", "-0.1", "0.1", "0.1"])
.succeeds() .succeeds()
.stdout_is("-0.1\n00.0\n00.1\n") .stdout_only("-0.1\n00.0\n00.1\n");
.no_stderr();
} }
#[test] #[test]
@ -735,8 +682,7 @@ fn test_rounding_end() {
new_ucmd!() new_ucmd!()
.args(&["1", "-1", "0.1"]) .args(&["1", "-1", "0.1"])
.succeeds() .succeeds()
.stdout_is("1\n") .stdout_only("1\n");
.no_stderr();
} }
#[test] #[test]