diff options
| author | Johann Hemmann <johann.hemmann@code.berlin> | 2024-01-04 14:55:28 +0100 |
|---|---|---|
| committer | Johann Hemmann <johann.hemmann@code.berlin> | 2024-01-04 15:14:05 +0100 |
| commit | f3770c14cf15c9ffe635dfbd5f99c7417db45acd (patch) | |
| tree | 2cda4e7b285c5ac231dc4dd5672eae7283e9b57b | |
| parent | e9632bd48bab007c74e72a1b5e9b72a19d8e2a13 (diff) | |
| download | rust-f3770c14cf15c9ffe635dfbd5f99c7417db45acd.tar.gz rust-f3770c14cf15c9ffe635dfbd5f99c7417db45acd.zip | |
Compare test ids instead of names, seems more robust
| -rw-r--r-- | crates/ide/src/runnables.rs | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index d6fe4de3b6f..ec50822df67 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -576,8 +576,14 @@ mod tests { fn check_tests(ra_fixture: &str, expect: Expect) { let (analysis, position) = fixture::position(ra_fixture); let tests = analysis.related_tests(position, None).unwrap(); - let test_names = tests.into_iter().map(|a| a.nav.name).collect::<Vec<_>>(); - expect.assert_debug_eq(&test_names); + let test_ids = tests + .into_iter() + .map(|runnable| match runnable.kind { + RunnableKind::Test { test_id, .. } => test_id, + _ => unreachable!(), + }) + .collect::<Vec<_>>(); + expect.assert_debug_eq(&test_ids); } #[test] @@ -2144,7 +2150,9 @@ mod tests { "#, expect![[r#" [ - "foo_test", + Path( + "tests::foo_test", + ), ] "#]], ); @@ -2169,7 +2177,9 @@ mod tests { "#, expect![[r#" [ - "foo_test", + Path( + "tests::foo_test", + ), ] "#]], ); @@ -2201,7 +2211,9 @@ mod tests { "#, expect![[r#" [ - "foo_test", + Path( + "tests::foo_test", + ), ] "#]], ); @@ -2233,8 +2245,12 @@ mod tests { "#, expect![[r#" [ - "foo2_test", - "foo_test", + Path( + "tests::foo2_test", + ), + Path( + "tests::foo_test", + ), ] "#]], ); |
