aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/tests/tests.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-05 11:57:41 +0000
committerAleksey Kladov <[email protected]>2018-11-05 11:57:41 +0000
commit0192c116f78b3a81ef15587eecac29a2676ae00c (patch)
treee4ade14c93e07ad1e55df0961ba5ca67902f29f7 /crates/ra_analysis/tests/tests.rs
parent1e1c188cbf1fbb80ee398977e6635b9a54a3ab7a (diff)
Use FilePosition everywhere
Diffstat (limited to 'crates/ra_analysis/tests/tests.rs')
-rw-r--r--crates/ra_analysis/tests/tests.rs26
1 files changed, 7 insertions, 19 deletions
diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs
index 7f7bb8e6b..c605d34f0 100644
--- a/crates/ra_analysis/tests/tests.rs
+++ b/crates/ra_analysis/tests/tests.rs
@@ -15,10 +15,7 @@ use ra_analysis::{
15 15
16fn get_signature(text: &str) -> (FnDescriptor, Option<usize>) { 16fn get_signature(text: &str) -> (FnDescriptor, Option<usize>) {
17 let (analysis, position) = single_file_with_position(text); 17 let (analysis, position) = single_file_with_position(text);
18 analysis 18 analysis.resolve_callable(position).unwrap().unwrap()
19 .resolve_callable(position.file_id, position.offset)
20 .unwrap()
21 .unwrap()
22} 19}
23 20
24#[test] 21#[test]
@@ -32,9 +29,7 @@ fn test_resolve_module() {
32 ", 29 ",
33 ); 30 );
34 31
35 let symbols = analysis 32 let symbols = analysis.approximately_resolve_symbol(pos).unwrap();
36 .approximately_resolve_symbol(pos.file_id, pos.offset)
37 .unwrap();
38 assert_eq_dbg( 33 assert_eq_dbg(
39 r#"[(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]"#, 34 r#"[(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]"#,
40 &symbols, 35 &symbols,
@@ -49,9 +44,7 @@ fn test_resolve_module() {
49 ", 44 ",
50 ); 45 );
51 46
52 let symbols = analysis 47 let symbols = analysis.approximately_resolve_symbol(pos).unwrap();
53 .approximately_resolve_symbol(pos.file_id, pos.offset)
54 .unwrap();
55 assert_eq_dbg( 48 assert_eq_dbg(
56 r#"[(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]"#, 49 r#"[(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]"#,
57 &symbols, 50 &symbols,
@@ -92,7 +85,7 @@ fn test_resolve_parent_module() {
92 <|>// empty 85 <|>// empty
93 ", 86 ",
94 ); 87 );
95 let symbols = analysis.parent_module(pos.file_id, pos.offset).unwrap(); 88 let symbols = analysis.parent_module(pos).unwrap();
96 assert_eq_dbg( 89 assert_eq_dbg(
97 r#"[(FileId(1), FileSymbol { name: "foo", node_range: [4; 7), kind: MODULE })]"#, 90 r#"[(FileId(1), FileSymbol { name: "foo", node_range: [4; 7), kind: MODULE })]"#,
98 &symbols, 91 &symbols,
@@ -111,7 +104,7 @@ fn test_resolve_parent_module_for_inline() {
111 } 104 }
112 ", 105 ",
113 ); 106 );
114 let symbols = analysis.parent_module(pos.file_id, pos.offset).unwrap(); 107 let symbols = analysis.parent_module(pos).unwrap();
115 assert_eq_dbg( 108 assert_eq_dbg(
116 r#"[(FileId(1), FileSymbol { name: "bar", node_range: [18; 21), kind: MODULE })]"#, 109 r#"[(FileId(1), FileSymbol { name: "bar", node_range: [18; 21), kind: MODULE })]"#,
117 &symbols, 110 &symbols,
@@ -397,9 +390,7 @@ By default this method stops actor's `Context`."#
397 390
398fn get_all_refs(text: &str) -> Vec<(FileId, TextRange)> { 391fn get_all_refs(text: &str) -> Vec<(FileId, TextRange)> {
399 let (analysis, position) = single_file_with_position(text); 392 let (analysis, position) = single_file_with_position(text);
400 analysis 393 analysis.find_all_refs(position).unwrap()
401 .find_all_refs(position.file_id, position.offset)
402 .unwrap()
403} 394}
404 395
405#[test] 396#[test]
@@ -454,10 +445,7 @@ fn test_complete_crate_path() {
454 use crate::Sp<|> 445 use crate::Sp<|>
455 ", 446 ",
456 ); 447 );
457 let completions = analysis 448 let completions = analysis.completions(position).unwrap().unwrap();
458 .completions(position.file_id, position.offset)
459 .unwrap()
460 .unwrap();
461 assert_eq_dbg( 449 assert_eq_dbg(
462 r#"[CompletionItem { label: "foo", lookup: None, snippet: None }, 450 r#"[CompletionItem { label: "foo", lookup: None, snippet: None },
463 CompletionItem { label: "Spam", lookup: None, snippet: None }]"#, 451 CompletionItem { label: "Spam", lookup: None, snippet: None }]"#,