aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-24 18:54:13 +0000
committerAleksey Kladov <[email protected]>2019-02-24 18:54:13 +0000
commitd5f6a5f5e29df3005533502b49f78daae314ac5b (patch)
tree20e86fbc586b350c336277d2b0886a60f9844de8 /crates/ra_ide_api/src
parent98510ec5d3478f3e9178bbff076532487292d8f8 (diff)
move testing functions
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/completion.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_fn_param.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_keyword.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs7
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_snippet.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_struct_literal.rs4
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs2
10 files changed, 14 insertions, 20 deletions
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index e13baa7a9..fbfd7e3e7 100644
--- a/crates/ra_ide_api/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
@@ -21,7 +21,10 @@ use crate::{
21 completion_item::{Completions, CompletionKind}, 21 completion_item::{Completions, CompletionKind},
22 completion_context::CompletionContext, 22 completion_context::CompletionContext,
23 }, 23 },
24
24}; 25};
26#[cfg(test)]
27use crate::completion::completion_item::{do_completion, check_completion};
25 28
26pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind, InsertTextFormat}; 29pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind, InsertTextFormat};
27 30
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index be76b997e..d5ad2e79f 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -58,8 +58,7 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty
58 58
59#[cfg(test)] 59#[cfg(test)]
60mod tests { 60mod tests {
61 use crate::completion::*; 61 use crate::completion::{check_completion, CompletionKind};
62 use crate::completion::completion_item::check_completion;
63 62
64 fn check_ref_completion(name: &str, code: &str) { 63 fn check_ref_completion(name: &str, code: &str) {
65 check_completion(name, code, CompletionKind::Reference); 64 check_completion(name, code, CompletionKind::Reference);
diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs
index 4d6416284..ffdc744b2 100644
--- a/crates/ra_ide_api/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs
@@ -54,8 +54,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
54 54
55#[cfg(test)] 55#[cfg(test)]
56mod tests { 56mod tests {
57 use crate::completion::*; 57 use crate::completion::{check_completion, CompletionKind};
58 use crate::completion::completion_item::check_completion;
59 58
60 fn check_magic_completion(name: &str, code: &str) { 59 fn check_magic_completion(name: &str, code: &str) {
61 check_completion(name, code, CompletionKind::Magic); 60 check_completion(name, code, CompletionKind::Magic);
diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs
index b667381a7..841c0c554 100644
--- a/crates/ra_ide_api/src/completion/complete_keyword.rs
+++ b/crates/ra_ide_api/src/completion/complete_keyword.rs
@@ -109,8 +109,7 @@ fn complete_return(
109 109
110#[cfg(test)] 110#[cfg(test)]
111mod tests { 111mod tests {
112 use crate::completion::CompletionKind; 112 use crate::completion::{check_completion, CompletionKind};
113 use crate::completion::completion_item::check_completion;
114 113
115 fn check_keyword_completion(name: &str, code: &str) { 114 fn check_keyword_completion(name: &str, code: &str) {
116 check_completion(name, code, CompletionKind::Keyword); 115 check_completion(name, code, CompletionKind::Keyword);
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 8e453b0e0..629a7ee77 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -57,13 +57,10 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
57 57
58#[cfg(test)] 58#[cfg(test)]
59mod tests { 59mod tests {
60 use crate::completion::{
61 CompletionKind,
62 completion_item::{check_completion, do_completion},
63};
64
65 use test_utils::covers; 60 use test_utils::covers;
66 61
62 use crate::completion::{CompletionKind, check_completion, do_completion};
63
67 fn check_reference_completion(code: &str, expected_completions: &str) { 64 fn check_reference_completion(code: &str, expected_completions: &str) {
68 check_completion(code, expected_completions, CompletionKind::Reference); 65 check_completion(code, expected_completions, CompletionKind::Reference);
69 } 66 }
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index ce3d6ed3c..4dfa5f176 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -56,8 +56,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
56 56
57#[cfg(test)] 57#[cfg(test)]
58mod tests { 58mod tests {
59 use crate::completion::completion_item::CompletionKind; 59 use crate::completion::{CompletionKind, check_completion};
60 use crate::completion::completion_item::check_completion;
61 60
62 fn check_snippet_completion(test_name: &str, code: &str) { 61 fn check_snippet_completion(test_name: &str, code: &str) {
63 check_completion(test_name, code, CompletionKind::Postfix); 62 check_completion(test_name, code, CompletionKind::Postfix);
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index b44b943ae..6146b7bb6 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -11,8 +11,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
11 11
12#[cfg(test)] 12#[cfg(test)]
13mod tests { 13mod tests {
14 use crate::completion::CompletionKind; 14 use crate::completion::{CompletionKind, check_completion};
15 use crate::completion::completion_item::check_completion;
16 15
17 fn check_reference_completion(name: &str, code: &str) { 16 fn check_reference_completion(name: &str, code: &str) {
18 check_completion(name, code, CompletionKind::Reference); 17 check_completion(name, code, CompletionKind::Reference);
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs
index aa3a16fa2..e1df9e625 100644
--- a/crates/ra_ide_api/src/completion/complete_snippet.rs
+++ b/crates/ra_ide_api/src/completion/complete_snippet.rs
@@ -36,8 +36,7 @@ fn ${1:feature}() {
36 36
37#[cfg(test)] 37#[cfg(test)]
38mod tests { 38mod tests {
39 use crate::completion::CompletionKind; 39 use crate::completion::{CompletionKind, check_completion};
40 use crate::completion::completion_item::check_completion;
41 40
42 fn check_snippet_completion(name: &str, code: &str) { 41 fn check_snippet_completion(name: &str, code: &str) {
43 check_completion(name, code, CompletionKind::Snippet); 42 check_completion(name, code, CompletionKind::Snippet);
diff --git a/crates/ra_ide_api/src/completion/complete_struct_literal.rs b/crates/ra_ide_api/src/completion/complete_struct_literal.rs
index 1b8fb0768..afb092f59 100644
--- a/crates/ra_ide_api/src/completion/complete_struct_literal.rs
+++ b/crates/ra_ide_api/src/completion/complete_struct_literal.rs
@@ -34,10 +34,10 @@ pub(super) fn complete_struct_literal(acc: &mut Completions, ctx: &CompletionCon
34#[cfg(test)] 34#[cfg(test)]
35mod tests { 35mod tests {
36 use insta::assert_debug_snapshot_matches; 36 use insta::assert_debug_snapshot_matches;
37 use crate::completion::{CompletionItem, CompletionKind}; 37 use crate::completion::{CompletionItem, CompletionKind, do_completion};
38 38
39 fn complete(code: &str) -> Vec<CompletionItem> { 39 fn complete(code: &str) -> Vec<CompletionItem> {
40 crate::completion::completion_item::do_completion(code, CompletionKind::Reference) 40 do_completion(code, CompletionKind::Reference)
41 } 41 }
42 42
43 #[test] 43 #[test]
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index 0ead52032..6454436c9 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -168,7 +168,7 @@ impl Completions {
168mod tests { 168mod tests {
169 use test_utils::covers; 169 use test_utils::covers;
170 170
171 use crate::completion::{CompletionKind, completion_item::check_completion}; 171 use crate::completion::{CompletionKind, check_completion};
172 172
173 fn check_reference_completion(code: &str, expected_completions: &str) { 173 fn check_reference_completion(code: &str, expected_completions: &str) {
174 check_completion(code, expected_completions, CompletionKind::Reference); 174 check_completion(code, expected_completions, CompletionKind::Reference);