diff options
author | Aleksey Kladov <[email protected]> | 2018-09-03 22:49:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-03 22:49:21 +0100 |
commit | c3e28f06463854e4711c4c49a49c77d1e136969f (patch) | |
tree | 9f031e9b9b38e1136a019e67120398f47f199066 /crates/server/tests/heavy_tests | |
parent | 952da31f44b717d5679c1c0baffcd998c0f67266 (diff) |
extern blocks
Diffstat (limited to 'crates/server/tests/heavy_tests')
-rw-r--r-- | crates/server/tests/heavy_tests/main.rs | 18 | ||||
-rw-r--r-- | crates/server/tests/heavy_tests/support.rs | 13 |
2 files changed, 26 insertions, 5 deletions
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 | ||
15 | use support::project; | 15 | use support::project; |
16 | 16 | ||
17 | |||
17 | const LOG: &'static str = ""; | 18 | const 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); |