aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/tests/test
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-11 15:17:20 +0000
committerAleksey Kladov <[email protected]>2019-01-11 15:32:22 +0000
commitdda916bc4d51383fcf84f736bd12c7a77c445fb0 (patch)
tree1d1a8246105eba1a16fd066365ea095ff0377740 /crates/ra_ide_api/tests/test
parent8a5f74a24f726a839f3a0e154cfadec23040e14c (diff)
fix tests
Diffstat (limited to 'crates/ra_ide_api/tests/test')
-rw-r--r--crates/ra_ide_api/tests/test/main.rs40
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;
4use test_utils::{assert_eq_dbg, assert_eq_text}; 4use test_utils::{assert_eq_dbg, assert_eq_text};
5 5
6use ra_ide_api::{ 6use 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]
38fn 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]
55fn 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]
74fn test_resolve_crate_root() { 38fn 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}