From c3e28f06463854e4711c4c49a49c77d1e136969f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 4 Sep 2018 00:49:21 +0300 Subject: extern blocks --- crates/server/tests/heavy_tests/main.rs | 18 ++++++++++++++++++ crates/server/tests/heavy_tests/support.rs | 13 ++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) (limited to 'crates/server/tests/heavy_tests') 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}; use support::project; + const LOG: &'static str = ""; #[test] @@ -79,3 +80,20 @@ fn test_eggs() {} ]"# ); } + +// #[test] +// fn test_deps() { +// let server = project(r#" +// //- Cargo.toml +// [package] +// name = "foo" +// version = "0.0.0" +// [dependencies] +// regex = "=1.0.4" + +// //- src/lib.rs +// extern crate regex; +// "#); +// server.wait_for_feedback("workspace loaded"); +// server.wait_for_feedback_n("library loaded", 1); +// } 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 { panic!("no response"); } pub fn wait_for_feedback(&self, feedback: &str) { + self.wait_for_feedback_n(feedback, 1) + } + pub fn wait_for_feedback_n(&self, feedback: &str, n: usize) { let f = |msg: &RawMessage| match msg { RawMessage::Notification(n) if n.method == "internalFeedback" => { return n.clone().cast::() @@ -162,18 +165,18 @@ impl Server { } _ => false, }; - + let mut total = 0; for msg in self.messages.borrow().iter() { if f(msg) { - return; + total += 1 } } - while let Some(msg) = self.recv() { + while total < n { + let msg = self.recv().expect("no response"); if f(&msg) { - return; + total += 1; } } - panic!("no response") } fn recv(&self) -> Option { let timeout = Duration::from_secs(5); -- cgit v1.2.3