aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-23 12:20:53 +0100
committerAleksey Kladov <[email protected]>2020-06-23 22:45:40 +0100
commit7ce122b1df3369cc9bc810cbe4047663491449cd (patch)
treea9e1bf901384003b5c740ac742c45407e1c1a048 /crates
parente2e373e0716cea4ea341c7f381da0d39f484cd30 (diff)
Remove useless test code
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/tests/heavy_tests/support.rs26
1 files changed, 4 insertions, 22 deletions
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs
index e80ffe5d1..001a2a104 100644
--- a/crates/rust-analyzer/tests/heavy_tests/support.rs
+++ b/crates/rust-analyzer/tests/heavy_tests/support.rs
@@ -9,9 +9,7 @@ use std::{
9use crossbeam_channel::{after, select, Receiver}; 9use crossbeam_channel::{after, select, Receiver};
10use lsp_server::{Connection, Message, Notification, Request}; 10use lsp_server::{Connection, Message, Notification, Request};
11use lsp_types::{ 11use lsp_types::{
12 notification::{DidOpenTextDocument, Exit}, 12 notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress,
13 request::Shutdown,
14 DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress,
15}; 13};
16use lsp_types::{ProgressParams, ProgressParamsValue}; 14use lsp_types::{ProgressParams, ProgressParamsValue};
17use serde::Serialize; 15use serde::Serialize;
@@ -66,13 +64,10 @@ impl<'a> Project<'a> {
66 ra_prof::init_from(crate::PROFILE); 64 ra_prof::init_from(crate::PROFILE);
67 }); 65 });
68 66
69 let mut paths = vec![];
70
71 for entry in Fixture::parse(self.fixture) { 67 for entry in Fixture::parse(self.fixture) {
72 let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]); 68 let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]);
73 fs::create_dir_all(path.parent().unwrap()).unwrap(); 69 fs::create_dir_all(path.parent().unwrap()).unwrap();
74 fs::write(path.as_path(), entry.text.as_bytes()).unwrap(); 70 fs::write(path.as_path(), entry.text.as_bytes()).unwrap();
75 paths.push((path, entry.text));
76 } 71 }
77 72
78 let mut roots = 73 let mut roots =
@@ -102,7 +97,7 @@ impl<'a> Project<'a> {
102 f(&mut config) 97 f(&mut config)
103 } 98 }
104 99
105 Server::new(tmp_dir, config, paths) 100 Server::new(tmp_dir, config)
106 } 101 }
107} 102}
108 103
@@ -120,7 +115,7 @@ pub struct Server {
120} 115}
121 116
122impl Server { 117impl Server {
123 fn new(dir: TempDir, config: Config, files: Vec<(PathBuf, String)>) -> Server { 118 fn new(dir: TempDir, config: Config) -> Server {
124 let (connection, client) = Connection::memory(); 119 let (connection, client) = Connection::memory();
125 120
126 let _thread = jod_thread::Builder::new() 121 let _thread = jod_thread::Builder::new()
@@ -128,20 +123,7 @@ impl Server {
128 .spawn(move || main_loop(config, connection).unwrap()) 123 .spawn(move || main_loop(config, connection).unwrap())
129 .expect("failed to spawn a thread"); 124 .expect("failed to spawn a thread");
130 125
131 let res = 126 Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread }
132 Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread };
133
134 for (path, text) in files {
135 res.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams {
136 text_document: TextDocumentItem {
137 uri: Url::from_file_path(path).unwrap(),
138 language_id: "rust".to_string(),
139 version: 0,
140 text,
141 },
142 })
143 }
144 res
145 } 127 }
146 128
147 pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier { 129 pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier {