mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Also compare navigation targets for tests
This commit is contained in:
parent
9bc005a3bf
commit
971fc1b3e8
1 changed files with 47 additions and 23 deletions
|
@ -581,14 +581,8 @@ 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_ids = tests
|
let navigation_targets = tests.into_iter().map(|runnable| runnable.nav).collect::<Vec<_>>();
|
||||||
.into_iter()
|
expect.assert_debug_eq(&navigation_targets);
|
||||||
.map(|runnable| match runnable.kind {
|
|
||||||
RunnableKind::Test { test_id, .. } => test_id,
|
|
||||||
_ => unreachable!(),
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
expect.assert_debug_eq(&test_ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1637,9 +1631,15 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
Path(
|
NavigationTarget {
|
||||||
"tests::foo_test",
|
file_id: FileId(
|
||||||
),
|
0,
|
||||||
|
),
|
||||||
|
full_range: 31..85,
|
||||||
|
focus_range: 46..54,
|
||||||
|
name: "foo_test",
|
||||||
|
kind: Function,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -1664,9 +1664,15 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
Path(
|
NavigationTarget {
|
||||||
"tests::foo_test",
|
file_id: FileId(
|
||||||
),
|
0,
|
||||||
|
),
|
||||||
|
full_range: 71..122,
|
||||||
|
focus_range: 86..94,
|
||||||
|
name: "foo_test",
|
||||||
|
kind: Function,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -1698,9 +1704,15 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
Path(
|
NavigationTarget {
|
||||||
"tests::foo_test",
|
file_id: FileId(
|
||||||
),
|
0,
|
||||||
|
),
|
||||||
|
full_range: 133..183,
|
||||||
|
focus_range: 148..156,
|
||||||
|
name: "foo_test",
|
||||||
|
kind: Function,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -1732,12 +1744,24 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
Path(
|
NavigationTarget {
|
||||||
"tests::foo2_test",
|
file_id: FileId(
|
||||||
),
|
0,
|
||||||
Path(
|
),
|
||||||
"tests::foo_test",
|
full_range: 121..185,
|
||||||
),
|
focus_range: 136..145,
|
||||||
|
name: "foo2_test",
|
||||||
|
kind: Function,
|
||||||
|
},
|
||||||
|
NavigationTarget {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
full_range: 52..115,
|
||||||
|
focus_range: 67..75,
|
||||||
|
name: "foo_test",
|
||||||
|
kind: Function,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue