mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Compare test ids instead of names, seems more robust
This commit is contained in:
parent
e9632bd48b
commit
f3770c14cf
1 changed files with 23 additions and 7 deletions
|
@ -576,8 +576,14 @@ mod tests {
|
||||||
fn check_tests(ra_fixture: &str, expect: Expect) {
|
fn check_tests(ra_fixture: &str, expect: Expect) {
|
||||||
let (analysis, position) = fixture::position(ra_fixture);
|
let (analysis, position) = fixture::position(ra_fixture);
|
||||||
let tests = analysis.related_tests(position, None).unwrap();
|
let tests = analysis.related_tests(position, None).unwrap();
|
||||||
let test_names = tests.into_iter().map(|a| a.nav.name).collect::<Vec<_>>();
|
let test_ids = tests
|
||||||
expect.assert_debug_eq(&test_names);
|
.into_iter()
|
||||||
|
.map(|runnable| match runnable.kind {
|
||||||
|
RunnableKind::Test { test_id, .. } => test_id,
|
||||||
|
_ => unreachable!(),
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
expect.assert_debug_eq(&test_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2144,7 +2150,9 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
"foo_test",
|
Path(
|
||||||
|
"tests::foo_test",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -2169,7 +2177,9 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
"foo_test",
|
Path(
|
||||||
|
"tests::foo_test",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -2201,7 +2211,9 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
"foo_test",
|
Path(
|
||||||
|
"tests::foo_test",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -2233,8 +2245,12 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
"foo2_test",
|
Path(
|
||||||
"foo_test",
|
"tests::foo2_test",
|
||||||
|
),
|
||||||
|
Path(
|
||||||
|
"tests::foo_test",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue