diff options
Diffstat (limited to 'crates/ra_lsp_server/tests/heavy_tests/main.rs')
-rw-r--r-- | crates/ra_lsp_server/tests/heavy_tests/main.rs | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index 9eaf46ac8..02d62a259 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs | |||
@@ -1,10 +1,15 @@ | |||
1 | mod support; | 1 | mod support; |
2 | 2 | ||
3 | use std::{ | ||
4 | collections::HashMap, | ||
5 | time::Instant, | ||
6 | }; | ||
7 | |||
3 | use languageserver_types::{ | 8 | use languageserver_types::{ |
4 | CodeActionContext, DocumentFormattingParams, FormattingOptions, Position, Range, | 9 | CodeActionContext, DocumentFormattingParams, FormattingOptions, Position, Range, |
5 | }; | 10 | }; |
6 | use ra_lsp_server::req::{ | 11 | use ra_lsp_server::req::{ |
7 | CodeActionParams, CodeActionRequest, Formatting, Runnables, RunnablesParams, | 12 | CodeActionParams, CodeActionRequest, Formatting, Runnables, RunnablesParams, CompletionParams, Completion, |
8 | }; | 13 | }; |
9 | use serde_json::json; | 14 | use serde_json::json; |
10 | 15 | ||
@@ -13,6 +18,32 @@ use crate::support::project; | |||
13 | const LOG: &'static str = ""; | 18 | const LOG: &'static str = ""; |
14 | 19 | ||
15 | #[test] | 20 | #[test] |
21 | fn completes_items_from_standard_library() { | ||
22 | let project_start = Instant::now(); | ||
23 | let server = project( | ||
24 | r#" | ||
25 | //- Cargo.toml | ||
26 | [package] | ||
27 | name = "foo" | ||
28 | version = "0.0.0" | ||
29 | |||
30 | //- src/lib.rs | ||
31 | use std::collections::Spam; | ||
32 | "#, | ||
33 | ); | ||
34 | server.wait_for_feedback("workspace loaded"); | ||
35 | eprintln!("loading took {:?}", project_start.elapsed()); | ||
36 | let completion_start = Instant::now(); | ||
37 | let res = server.send_request::<Completion>(CompletionParams { | ||
38 | text_document: server.doc_id("src/lib.rs"), | ||
39 | context: None, | ||
40 | position: Position::new(0, 23), | ||
41 | }); | ||
42 | assert!(format!("{}", res).contains("HashMap")); | ||
43 | eprintln!("completion took {:?}", completion_start.elapsed()); | ||
44 | } | ||
45 | |||
46 | #[test] | ||
16 | fn test_runnables_no_project() { | 47 | fn test_runnables_no_project() { |
17 | let server = project( | 48 | let server = project( |
18 | r" | 49 | r" |
@@ -122,7 +153,6 @@ fn test_eggs() {} | |||
122 | ); | 153 | ); |
123 | } | 154 | } |
124 | 155 | ||
125 | use std::collections::HashMap; | ||
126 | #[test] | 156 | #[test] |
127 | fn test_format_document() { | 157 | fn test_format_document() { |
128 | let server = project( | 158 | let server = project( |