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/src/main_loop/mod.rs | 2 +- crates/server/tests/heavy_tests/main.rs | 18 ++++++++++++++++++ crates/server/tests/heavy_tests/support.rs | 13 ++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) (limited to 'crates/server') 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( } recv(libdata_receiver, data) => Event::Lib(data.unwrap()) }; - trace!("selected {:?}", event); let mut state_changed = false; match event { Event::Task(task) => on_task(task, msg_sender, pending_requests), @@ -163,6 +162,7 @@ fn main_loop_inner( } } Event::Lib(lib) => { + feedback(internal_mode, "library loaded", msg_sender); state.add_lib(lib); } 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}; 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