aboutsummaryrefslogtreecommitdiff
path: root/crates/server
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-03 22:49:21 +0100
committerAleksey Kladov <[email protected]>2018-09-03 22:49:21 +0100
commitc3e28f06463854e4711c4c49a49c77d1e136969f (patch)
tree9f031e9b9b38e1136a019e67120398f47f199066 /crates/server
parent952da31f44b717d5679c1c0baffcd998c0f67266 (diff)
extern blocks
Diffstat (limited to 'crates/server')
-rw-r--r--crates/server/src/main_loop/mod.rs2
-rw-r--r--crates/server/tests/heavy_tests/main.rs18
-rw-r--r--crates/server/tests/heavy_tests/support.rs13
3 files changed, 27 insertions, 6 deletions
diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs
index b66a24de1..58f6f88a7 100644
--- a/crates/server/src/main_loop/mod.rs
+++ b/crates/server/src/main_loop/mod.rs
@@ -126,7 +126,6 @@ fn main_loop_inner(
126 } 126 }
127 recv(libdata_receiver, data) => Event::Lib(data.unwrap()) 127 recv(libdata_receiver, data) => Event::Lib(data.unwrap())
128 }; 128 };
129 trace!("selected {:?}", event);
130 let mut state_changed = false; 129 let mut state_changed = false;
131 match event { 130 match event {
132 Event::Task(task) => on_task(task, msg_sender, pending_requests), 131 Event::Task(task) => on_task(task, msg_sender, pending_requests),
@@ -163,6 +162,7 @@ fn main_loop_inner(
163 } 162 }
164 } 163 }
165 Event::Lib(lib) => { 164 Event::Lib(lib) => {
165 feedback(internal_mode, "library loaded", msg_sender);
166 state.add_lib(lib); 166 state.add_lib(lib);
167 } 167 }
168 Event::Msg(msg) => { 168 Event::Msg(msg) => {
diff --git a/crates/server/tests/heavy_tests/main.rs b/crates/server/tests/heavy_tests/main.rs
index d6e89bdf2..66620ac62 100644
--- a/crates/server/tests/heavy_tests/main.rs
+++ b/crates/server/tests/heavy_tests/main.rs
@@ -14,6 +14,7 @@ use m::req::{Runnables, RunnablesParams};
14 14
15use support::project; 15use support::project;
16 16
17
17const LOG: &'static str = ""; 18const LOG: &'static str = "";
18 19
19#[test] 20#[test]
@@ -79,3 +80,20 @@ fn test_eggs() {}
79 ]"# 80 ]"#
80 ); 81 );
81} 82}
83
84// #[test]
85// fn test_deps() {
86// let server = project(r#"
87// //- Cargo.toml
88// [package]
89// name = "foo"
90// version = "0.0.0"
91// [dependencies]
92// regex = "=1.0.4"
93
94// //- src/lib.rs
95// extern crate regex;
96// "#);
97// server.wait_for_feedback("workspace loaded");
98// server.wait_for_feedback_n("library loaded", 1);
99// }
diff --git a/crates/server/tests/heavy_tests/support.rs b/crates/server/tests/heavy_tests/support.rs
index 99a784e8d..731c2f51c 100644
--- a/crates/server/tests/heavy_tests/support.rs
+++ b/crates/server/tests/heavy_tests/support.rs
@@ -155,6 +155,9 @@ impl Server {
155 panic!("no response"); 155 panic!("no response");
156 } 156 }
157 pub fn wait_for_feedback(&self, feedback: &str) { 157 pub fn wait_for_feedback(&self, feedback: &str) {
158 self.wait_for_feedback_n(feedback, 1)
159 }
160 pub fn wait_for_feedback_n(&self, feedback: &str, n: usize) {
158 let f = |msg: &RawMessage| match msg { 161 let f = |msg: &RawMessage| match msg {
159 RawMessage::Notification(n) if n.method == "internalFeedback" => { 162 RawMessage::Notification(n) if n.method == "internalFeedback" => {
160 return n.clone().cast::<req::InternalFeedback>() 163 return n.clone().cast::<req::InternalFeedback>()
@@ -162,18 +165,18 @@ impl Server {
162 } 165 }
163 _ => false, 166 _ => false,
164 }; 167 };
165 168 let mut total = 0;
166 for msg in self.messages.borrow().iter() { 169 for msg in self.messages.borrow().iter() {
167 if f(msg) { 170 if f(msg) {
168 return; 171 total += 1
169 } 172 }
170 } 173 }
171 while let Some(msg) = self.recv() { 174 while total < n {
175 let msg = self.recv().expect("no response");
172 if f(&msg) { 176 if f(&msg) {
173 return; 177 total += 1;
174 } 178 }
175 } 179 }
176 panic!("no response")
177 } 180 }
178 fn recv(&self) -> Option<RawMessage> { 181 fn recv(&self) -> Option<RawMessage> {
179 let timeout = Duration::from_secs(5); 182 let timeout = Duration::from_secs(5);