Skip to content

Commit f3770c1

Browse files
committed
Compare test ids instead of names, seems more robust
1 parent e9632bd commit f3770c1

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

crates/ide/src/runnables.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,14 @@ mod tests {
576576
fn check_tests(ra_fixture: &str, expect: Expect) {
577577
let (analysis, position) = fixture::position(ra_fixture);
578578
let tests = analysis.related_tests(position, None).unwrap();
579-
let test_names = tests.into_iter().map(|a| a.nav.name).collect::<Vec<_>>();
580-
expect.assert_debug_eq(&test_names);
579+
let test_ids = tests
580+
.into_iter()
581+
.map(|runnable| match runnable.kind {
582+
RunnableKind::Test { test_id, .. } => test_id,
583+
_ => unreachable!(),
584+
})
585+
.collect::<Vec<_>>();
586+
expect.assert_debug_eq(&test_ids);
581587
}
582588

583589
#[test]
@@ -2144,7 +2150,9 @@ mod tests {
21442150
"#,
21452151
expect![[r#"
21462152
[
2147-
"foo_test",
2153+
Path(
2154+
"tests::foo_test",
2155+
),
21482156
]
21492157
"#]],
21502158
);
@@ -2169,7 +2177,9 @@ mod tests {
21692177
"#,
21702178
expect![[r#"
21712179
[
2172-
"foo_test",
2180+
Path(
2181+
"tests::foo_test",
2182+
),
21732183
]
21742184
"#]],
21752185
);
@@ -2201,7 +2211,9 @@ mod tests {
22012211
"#,
22022212
expect![[r#"
22032213
[
2204-
"foo_test",
2214+
Path(
2215+
"tests::foo_test",
2216+
),
22052217
]
22062218
"#]],
22072219
);
@@ -2233,8 +2245,12 @@ mod tests {
22332245
"#,
22342246
expect![[r#"
22352247
[
2236-
"foo2_test",
2237-
"foo_test",
2248+
Path(
2249+
"tests::foo2_test",
2250+
),
2251+
Path(
2252+
"tests::foo_test",
2253+
),
22382254
]
22392255
"#]],
22402256
);

0 commit comments

Comments
 (0)