Skip to content

Commit

Permalink
master
Browse files Browse the repository at this point in the history
58a99f4  SoftHardTagBranchMore
Fixed error message for newer version
  • Loading branch information
la10736 committed Oct 2, 2022
1 parent 737ccdd commit c326292
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions rstest/tests/rstest/mod.rs
Expand Up @@ -1069,7 +1069,7 @@ mod should_show_correct_errors {
--> {}/src/lib.rs:16:29
|
16 | fn error_fixture_wrong_type(fixture: String, f: u32) {{}}
| ^^^^^^^",
",
name
)
.unindent()
Expand Down Expand Up @@ -1116,34 +1116,32 @@ mod should_show_correct_errors {
fn if_arbitrary_rust_code_has_some_errors() {
let (output, name) = execute();

assert_in!(
output.stderr.str(),
assert_regex!(
format!(
"
error[E0308]: mismatched types
--> {}/src/lib.rs:22:31
|
22 | case(vec![1,2,3].contains(2)))
| ^
| |",
r#"error\[E0308\]: mismatched types
\s+--> {}/src/lib\.rs:22:31"#,
name
)
.unindent()
.unindent(),
output.stderr.str()
);
assert_regex!(
r#"22\s+|\s+case\(vec!\[1,2,3\]\.contains\(2\)\)\)"#,
output.stderr.str()
);

assert_in!(
output.stderr.str(),
assert_regex!(
format!(
"
error[E0308]: mismatched types
--> {}/src/lib.rs:53:45
|
53 | #[rstest(condition => [vec![1,2,3].contains(2)] )]
| ^
| |",
r#"error\[E0308\]: mismatched types
\s+--> {}/src/lib\.rs:53:45"#,
name
)
.unindent()
.unindent(),
output.stderr.str()
);
assert_regex!(
r#"53\s+|\s+#\[rstest\(condition => \[vec!\[1,2,3\]\.contains\(2\)\] \)\]"#,
output.stderr.str()
);
}

Expand Down Expand Up @@ -1377,7 +1375,7 @@ mod should_show_correct_errors {
assert_in!(output.stderr.str(), format!("--> {}/src/lib.rs:84:1", name));
assert_in!(
output.stderr.str(),
"| --------- doesn't satisfy `S: FromStr`"
"| -------- doesn't satisfy `S: FromStr`"
);
}

Expand Down Expand Up @@ -1468,14 +1466,19 @@ mod should_show_correct_errors {
format!(
"
error[E0308]: mismatched types
--> {}/src/lib.rs:105:11
|
105 | #[timeout(42)]
| ^^ expected struct `Duration`, found integer
",
--> {}/src/lib.rs:105:11",
name
)
.unindent()
);

assert_in!(
output.stderr.str(),
"
105 | #[timeout(42)]
| ^^ expected struct `Duration`, found integer
"
.unindent()
);
}
}

0 comments on commit c326292

Please sign in to comment.