Skip to content

Commit 971fc1b

Browse files
committed
Also compare navigation targets for tests
1 parent 9bc005a commit 971fc1b

File tree

1 file changed

+47
-23
lines changed

1 file changed

+47
-23
lines changed

crates/ide/src/runnables.rs

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,8 @@ mod tests {
581581
fn check_tests(ra_fixture: &str, expect: Expect) {
582582
let (analysis, position) = fixture::position(ra_fixture);
583583
let tests = analysis.related_tests(position, None).unwrap();
584-
let test_ids = tests
585-
.into_iter()
586-
.map(|runnable| match runnable.kind {
587-
RunnableKind::Test { test_id, .. } => test_id,
588-
_ => unreachable!(),
589-
})
590-
.collect::<Vec<_>>();
591-
expect.assert_debug_eq(&test_ids);
584+
let navigation_targets = tests.into_iter().map(|runnable| runnable.nav).collect::<Vec<_>>();
585+
expect.assert_debug_eq(&navigation_targets);
592586
}
593587

594588
#[test]
@@ -1637,9 +1631,15 @@ mod tests {
16371631
"#,
16381632
expect![[r#"
16391633
[
1640-
Path(
1641-
"tests::foo_test",
1642-
),
1634+
NavigationTarget {
1635+
file_id: FileId(
1636+
0,
1637+
),
1638+
full_range: 31..85,
1639+
focus_range: 46..54,
1640+
name: "foo_test",
1641+
kind: Function,
1642+
},
16431643
]
16441644
"#]],
16451645
);
@@ -1664,9 +1664,15 @@ mod tests {
16641664
"#,
16651665
expect![[r#"
16661666
[
1667-
Path(
1668-
"tests::foo_test",
1669-
),
1667+
NavigationTarget {
1668+
file_id: FileId(
1669+
0,
1670+
),
1671+
full_range: 71..122,
1672+
focus_range: 86..94,
1673+
name: "foo_test",
1674+
kind: Function,
1675+
},
16701676
]
16711677
"#]],
16721678
);
@@ -1698,9 +1704,15 @@ mod tests {
16981704
"#,
16991705
expect![[r#"
17001706
[
1701-
Path(
1702-
"tests::foo_test",
1703-
),
1707+
NavigationTarget {
1708+
file_id: FileId(
1709+
0,
1710+
),
1711+
full_range: 133..183,
1712+
focus_range: 148..156,
1713+
name: "foo_test",
1714+
kind: Function,
1715+
},
17041716
]
17051717
"#]],
17061718
);
@@ -1732,12 +1744,24 @@ mod tests {
17321744
"#,
17331745
expect![[r#"
17341746
[
1735-
Path(
1736-
"tests::foo2_test",
1737-
),
1738-
Path(
1739-
"tests::foo_test",
1740-
),
1747+
NavigationTarget {
1748+
file_id: FileId(
1749+
0,
1750+
),
1751+
full_range: 121..185,
1752+
focus_range: 136..145,
1753+
name: "foo2_test",
1754+
kind: Function,
1755+
},
1756+
NavigationTarget {
1757+
file_id: FileId(
1758+
0,
1759+
),
1760+
full_range: 52..115,
1761+
focus_range: 67..75,
1762+
name: "foo_test",
1763+
kind: Function,
1764+
},
17411765
]
17421766
"#]],
17431767
);

0 commit comments

Comments
 (0)