diff options
author | Aleksey Kladov <[email protected]> | 2018-09-02 14:36:03 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-02 14:36:03 +0100 |
commit | e98d8cd255ab5c2fee873a58af6c2c3ad561dab4 (patch) | |
tree | 04869b8fe93e724d8aa266177e48644051331ab9 /crates/server/tests/heavy_tests/support.rs | |
parent | 1329dd4e287c137ec0a90abeec0272275b2b2c8d (diff) |
nail down runnables
Diffstat (limited to 'crates/server/tests/heavy_tests/support.rs')
-rw-r--r-- | crates/server/tests/heavy_tests/support.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/server/tests/heavy_tests/support.rs b/crates/server/tests/heavy_tests/support.rs index 76cbd56ea..38a9e6c76 100644 --- a/crates/server/tests/heavy_tests/support.rs +++ b/crates/server/tests/heavy_tests/support.rs | |||
@@ -134,7 +134,7 @@ impl Server { | |||
134 | { | 134 | { |
135 | let expected = expected.replace("$PROJECT_ROOT$", &self.dir.path().display().to_string()); | 135 | let expected = expected.replace("$PROJECT_ROOT$", &self.dir.path().display().to_string()); |
136 | let expected: Value = from_str(&expected).unwrap(); | 136 | let expected: Value = from_str(&expected).unwrap(); |
137 | let actual = self.wait_for_notification(N::METHOD); | 137 | let actual = self.wait_for_notification::<N>(); |
138 | assert_eq!( | 138 | assert_eq!( |
139 | expected, actual, | 139 | expected, actual, |
140 | "Expected:\n{}\n\ | 140 | "Expected:\n{}\n\ |
@@ -150,6 +150,11 @@ impl Server { | |||
150 | R::Params: Serialize, | 150 | R::Params: Serialize, |
151 | { | 151 | { |
152 | let r = RawRequest::new::<R>(id, ¶ms); | 152 | let r = RawRequest::new::<R>(id, ¶ms); |
153 | self.send_request_(r) | ||
154 | } | ||
155 | fn send_request_(&self, r: RawRequest) -> Value | ||
156 | { | ||
157 | let id = r.id; | ||
153 | self.sender.as_ref() | 158 | self.sender.as_ref() |
154 | .unwrap() | 159 | .unwrap() |
155 | .send(RawMessage::Request(r)); | 160 | .send(RawMessage::Request(r)); |
@@ -168,7 +173,10 @@ impl Server { | |||
168 | } | 173 | } |
169 | panic!("no response"); | 174 | panic!("no response"); |
170 | } | 175 | } |
171 | fn wait_for_notification(&self, method: &str) -> Value { | 176 | pub fn wait_for_notification<N: Notification>(&self) -> Value { |
177 | self.wait_for_notification_(N::METHOD) | ||
178 | } | ||
179 | fn wait_for_notification_(&self, method: &str) -> Value { | ||
172 | let f = |msg: &RawMessage| match msg { | 180 | let f = |msg: &RawMessage| match msg { |
173 | RawMessage::Notification(n) if n.method == method => { | 181 | RawMessage::Notification(n) if n.method == method => { |
174 | Some(n.params.clone()) | 182 | Some(n.params.clone()) |
@@ -215,7 +223,6 @@ impl Drop for Server { | |||
215 | drop(msg); | 223 | drop(msg); |
216 | } | 224 | } |
217 | } | 225 | } |
218 | eprintln!("joining server"); | ||
219 | self.server.take() | 226 | self.server.take() |
220 | .unwrap() | 227 | .unwrap() |
221 | .join().unwrap().unwrap(); | 228 | .join().unwrap().unwrap(); |