diff options
Diffstat (limited to 'crates/ra_hir/src/nameres/tests.rs')
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 9322bf08c..c033bebe8 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -20,7 +20,7 @@ fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) { | |||
20 | } | 20 | } |
21 | 21 | ||
22 | fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { | 22 | fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { |
23 | let mut lines = map.per_module[&module_id] | 23 | let mut lines = map[module_id] |
24 | .items | 24 | .items |
25 | .iter() | 25 | .iter() |
26 | .map(|(name, res)| format!("{}: {}", name, dump_resolution(res))) | 26 | .map(|(name, res)| format!("{}: {}", name, dump_resolution(res))) |
@@ -37,8 +37,8 @@ fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { | |||
37 | 37 | ||
38 | fn dump_resolution(resolution: &Resolution) -> &'static str { | 38 | fn dump_resolution(resolution: &Resolution) -> &'static str { |
39 | match ( | 39 | match ( |
40 | resolution.def_id.types.is_some(), | 40 | resolution.def.types.is_some(), |
41 | resolution.def_id.values.is_some(), | 41 | resolution.def.values.is_some(), |
42 | ) { | 42 | ) { |
43 | (true, true) => "t v", | 43 | (true, true) => "t v", |
44 | (true, false) => "t", | 44 | (true, false) => "t", |
@@ -216,6 +216,27 @@ fn item_map_using_self() { | |||
216 | } | 216 | } |
217 | 217 | ||
218 | #[test] | 218 | #[test] |
219 | fn item_map_enum_importing() { | ||
220 | covers!(item_map_enum_importing); | ||
221 | let (item_map, module_id) = item_map( | ||
222 | " | ||
223 | //- /lib.rs | ||
224 | enum E { V } | ||
225 | use self::E::V; | ||
226 | <|> | ||
227 | ", | ||
228 | ); | ||
229 | check_module_item_map( | ||
230 | &item_map, | ||
231 | module_id, | ||
232 | " | ||
233 | E: t | ||
234 | V: t v | ||
235 | ", | ||
236 | ); | ||
237 | } | ||
238 | |||
239 | #[test] | ||
219 | fn item_map_across_crates() { | 240 | fn item_map_across_crates() { |
220 | let (mut db, sr) = MockDatabase::with_files( | 241 | let (mut db, sr) = MockDatabase::with_files( |
221 | " | 242 | " |