aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres/tests.rs')
-rw-r--r--crates/ra_hir/src/nameres/tests.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index 8c6b40aaf..02db91a86 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -6,30 +6,25 @@ mod mod_resolution;
6 6
7use std::sync::Arc; 7use std::sync::Arc;
8 8
9use hir_def::{db::DefDatabase2, nameres::*, CrateModuleId};
9use insta::assert_snapshot; 10use insta::assert_snapshot;
10use ra_db::SourceDatabase; 11use ra_db::SourceDatabase;
11use test_utils::covers; 12// use test_utils::covers;
12 13
13use crate::{ 14use crate::mock::{CrateGraphFixture, MockDatabase};
14 mock::{CrateGraphFixture, MockDatabase},
15 Crate,
16};
17
18use super::*;
19 15
20fn compute_crate_def_map(fixture: &str, graph: Option<CrateGraphFixture>) -> Arc<CrateDefMap> { 16fn compute_crate_def_map(fixture: &str, graph: Option<CrateGraphFixture>) -> Arc<CrateDefMap> {
21 let mut db = MockDatabase::with_files(fixture); 17 let mut db = MockDatabase::with_files(fixture);
22 if let Some(graph) = graph { 18 if let Some(graph) = graph {
23 db.set_crate_graph_from_fixture(graph); 19 db.set_crate_graph_from_fixture(graph);
24 } 20 }
25 let crate_id = db.crate_graph().iter().next().unwrap(); 21 let krate = db.crate_graph().iter().next().unwrap();
26 let krate = Crate { crate_id };
27 db.crate_def_map(krate) 22 db.crate_def_map(krate)
28} 23}
29 24
30fn render_crate_def_map(map: &CrateDefMap) -> String { 25fn render_crate_def_map(map: &CrateDefMap) -> String {
31 let mut buf = String::new(); 26 let mut buf = String::new();
32 go(&mut buf, map, "\ncrate", map.root); 27 go(&mut buf, map, "\ncrate", map.root());
33 return buf.trim().to_string(); 28 return buf.trim().to_string();
34 29
35 fn go(buf: &mut String, map: &CrateDefMap, path: &str, module: CrateModuleId) { 30 fn go(buf: &mut String, map: &CrateDefMap, path: &str, module: CrateModuleId) {
@@ -118,7 +113,7 @@ fn crate_def_map_smoke_test() {
118 113
119#[test] 114#[test]
120fn bogus_paths() { 115fn bogus_paths() {
121 covers!(bogus_paths); 116 // covers!(bogus_paths);
122 let map = def_map( 117 let map = def_map(
123 " 118 "
124 //- /lib.rs 119 //- /lib.rs
@@ -233,7 +228,7 @@ fn re_exports() {
233 228
234#[test] 229#[test]
235fn std_prelude() { 230fn std_prelude() {
236 covers!(std_prelude); 231 // covers!(std_prelude);
237 let map = def_map_with_crate_graph( 232 let map = def_map_with_crate_graph(
238 " 233 "
239 //- /main.rs 234 //- /main.rs
@@ -261,7 +256,7 @@ fn std_prelude() {
261 256
262#[test] 257#[test]
263fn can_import_enum_variant() { 258fn can_import_enum_variant() {
264 covers!(can_import_enum_variant); 259 // covers!(can_import_enum_variant);
265 let map = def_map( 260 let map = def_map(
266 " 261 "
267 //- /lib.rs 262 //- /lib.rs