aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r--crates/ra_hir/src/nameres/tests.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index 971f71637..3d420467c 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -19,11 +19,12 @@ fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) {
19 (db.item_map(krate.crate_id), module_id) 19 (db.item_map(krate.crate_id), module_id)
20} 20}
21 21
22fn item_map_custom_crate_root(fixture: &str, root: &str) -> (Arc<ItemMap>, ModuleId) { 22/// Sets the crate root to the file of the cursor marker
23fn item_map_custom_crate_root(fixture: &str) -> (Arc<ItemMap>, ModuleId) {
23 let (mut db, pos) = MockDatabase::with_position(fixture); 24 let (mut db, pos) = MockDatabase::with_position(fixture);
24 25
25 let mut crate_graph = CrateGraph::default(); 26 let mut crate_graph = CrateGraph::default();
26 crate_graph.add_crate_root(db.file_id(root)); 27 crate_graph.add_crate_root(pos.file_id);
27 db.set_crate_graph(Arc::new(crate_graph)); 28 db.set_crate_graph(Arc::new(crate_graph));
28 29
29 let module = crate::source_binder::module_from_position(&db, pos).unwrap(); 30 let module = crate::source_binder::module_from_position(&db, pos).unwrap();
@@ -152,14 +153,11 @@ fn module_resolution_works_for_non_standard_filenames() {
152 " 153 "
153 //- /my_library.rs 154 //- /my_library.rs
154 mod foo; 155 mod foo;
155
156 use self::foo::Bar; 156 use self::foo::Bar;
157 <|> 157 <|>
158
159 //- /foo/mod.rs 158 //- /foo/mod.rs
160 pub struct Bar; 159 pub struct Bar;
161 ", 160 ",
162 "/my_library.rs",
163 ); 161 );
164 check_module_item_map( 162 check_module_item_map(
165 &item_map, 163 &item_map,