Skip to content

Commit 85ed5a3

Browse files
committed
Make hover test not relient on minicore structure
1 parent 5360c9b commit 85ed5a3

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

crates/ide/src/hover/tests.rs

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,46 +2361,53 @@ fn foo(ar$0g: &impl Foo + Bar<S>) {}
23612361
fn test_hover_async_block_impl_trait_has_goto_type_action() {
23622362
check_actions(
23632363
r#"
2364-
//- minicore: future
2364+
//- /main.rs crate:main deps:core
2365+
// we don't use minicore here so that this test doesn't randomly fail
2366+
// when someone edits minicore
23652367
struct S;
23662368
fn foo() {
23672369
let fo$0o = async { S };
23682370
}
2371+
//- /core.rs crate:core
2372+
pub mod future {
2373+
#[lang = "future_trait"]
2374+
pub trait Future {}
2375+
}
23692376
"#,
23702377
expect![[r#"
2371-
[
2372-
GoToType(
2373-
[
2374-
HoverGotoTypeData {
2375-
mod_path: "core::future::Future",
2376-
nav: NavigationTarget {
2377-
file_id: FileId(
2378-
1,
2379-
),
2380-
full_range: 276..458,
2381-
focus_range: 315..321,
2382-
name: "Future",
2383-
kind: Trait,
2384-
description: "pub trait Future",
2385-
},
2378+
[
2379+
GoToType(
2380+
[
2381+
HoverGotoTypeData {
2382+
mod_path: "core::future::Future",
2383+
nav: NavigationTarget {
2384+
file_id: FileId(
2385+
1,
2386+
),
2387+
full_range: 21..69,
2388+
focus_range: 60..66,
2389+
name: "Future",
2390+
kind: Trait,
2391+
description: "pub trait Future",
23862392
},
2387-
HoverGotoTypeData {
2388-
mod_path: "test::S",
2389-
nav: NavigationTarget {
2390-
file_id: FileId(
2391-
0,
2392-
),
2393-
full_range: 0..9,
2394-
focus_range: 7..8,
2395-
name: "S",
2396-
kind: Struct,
2397-
description: "struct S",
2398-
},
2393+
},
2394+
HoverGotoTypeData {
2395+
mod_path: "main::S",
2396+
nav: NavigationTarget {
2397+
file_id: FileId(
2398+
0,
2399+
),
2400+
full_range: 0..110,
2401+
focus_range: 108..109,
2402+
name: "S",
2403+
kind: Struct,
2404+
description: "struct S",
23992405
},
2400-
],
2401-
),
2402-
]
2403-
"#]],
2406+
},
2407+
],
2408+
),
2409+
]
2410+
"#]],
24042411
);
24052412
}
24062413

0 commit comments

Comments
 (0)