diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-11 15:35:41 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-11 15:35:41 +0000 |
commit | aad1bf877e4ba5ce9e28e8bde14f790ef8d1551b (patch) | |
tree | 9d3ea7f166adcd09fb77cfdb7fc1bad03efc95cd /crates/ra_ide_api/tests/test/main.rs | |
parent | 0b83bde6e2f3782ea6acd907fa0a634912cebb3d (diff) | |
parent | f23a13bfa7bae7e34070bfd14d22b70a82315022 (diff) |
Merge #496
496: Include two element ranges into the nav. r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/tests/test/main.rs')
-rw-r--r-- | crates/ra_ide_api/tests/test/main.rs | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/crates/ra_ide_api/tests/test/main.rs b/crates/ra_ide_api/tests/test/main.rs index d1dc07e5b..7dc1dba73 100644 --- a/crates/ra_ide_api/tests/test/main.rs +++ b/crates/ra_ide_api/tests/test/main.rs | |||
@@ -4,7 +4,7 @@ use ra_syntax::TextRange; | |||
4 | use test_utils::{assert_eq_dbg, assert_eq_text}; | 4 | use test_utils::{assert_eq_dbg, assert_eq_text}; |
5 | 5 | ||
6 | use ra_ide_api::{ | 6 | use ra_ide_api::{ |
7 | mock_analysis::{analysis_and_position, single_file, single_file_with_position, MockAnalysis}, | 7 | mock_analysis::{single_file, single_file_with_position, MockAnalysis}, |
8 | AnalysisChange, CrateGraph, FileId, Query | 8 | AnalysisChange, CrateGraph, FileId, Query |
9 | }; | 9 | }; |
10 | 10 | ||
@@ -35,42 +35,6 @@ fn test_unresolved_module_diagnostic_no_diag_for_inline_mode() { | |||
35 | } | 35 | } |
36 | 36 | ||
37 | #[test] | 37 | #[test] |
38 | fn test_resolve_parent_module() { | ||
39 | let (analysis, pos) = analysis_and_position( | ||
40 | " | ||
41 | //- /lib.rs | ||
42 | mod foo; | ||
43 | //- /foo.rs | ||
44 | <|>// empty | ||
45 | ", | ||
46 | ); | ||
47 | let symbols = analysis.parent_module(pos).unwrap(); | ||
48 | assert_eq_dbg( | ||
49 | r#"[NavigationTarget { file_id: FileId(1), name: "foo", kind: MODULE, range: [4; 7), ptr: None }]"#, | ||
50 | &symbols, | ||
51 | ); | ||
52 | } | ||
53 | |||
54 | #[test] | ||
55 | fn test_resolve_parent_module_for_inline() { | ||
56 | let (analysis, pos) = analysis_and_position( | ||
57 | " | ||
58 | //- /lib.rs | ||
59 | mod foo { | ||
60 | mod bar { | ||
61 | mod baz { <|> } | ||
62 | } | ||
63 | } | ||
64 | ", | ||
65 | ); | ||
66 | let symbols = analysis.parent_module(pos).unwrap(); | ||
67 | assert_eq_dbg( | ||
68 | r#"[NavigationTarget { file_id: FileId(1), name: "baz", kind: MODULE, range: [36; 39), ptr: None }]"#, | ||
69 | &symbols, | ||
70 | ); | ||
71 | } | ||
72 | |||
73 | #[test] | ||
74 | fn test_resolve_crate_root() { | 38 | fn test_resolve_crate_root() { |
75 | let mock = MockAnalysis::with_files( | 39 | let mock = MockAnalysis::with_files( |
76 | " | 40 | " |
@@ -245,5 +209,5 @@ pub trait HirDatabase: SyntaxDatabase {} | |||
245 | let mut symbols = analysis.symbol_search(Query::new("Hir".into())).unwrap(); | 209 | let mut symbols = analysis.symbol_search(Query::new("Hir".into())).unwrap(); |
246 | let s = symbols.pop().unwrap(); | 210 | let s = symbols.pop().unwrap(); |
247 | assert_eq!(s.name(), "HirDatabase"); | 211 | assert_eq!(s.name(), "HirDatabase"); |
248 | assert_eq!(s.range(), TextRange::from_to(33.into(), 44.into())); | 212 | assert_eq!(s.full_range(), TextRange::from_to(33.into(), 44.into())); |
249 | } | 213 | } |