Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
test: fix the progress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jun 11, 2022
1 parent 2d1c14e commit 7ab4c08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 6 additions & 3 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,13 @@ fn client_test_simple_workspace() {
let count = rls
.messages()
.iter()
.filter(|msg| msg["method"] == "window/progress")
.filter(|msg| msg["params"]["title"] == "Building")
.filter(|msg| msg["method"] == "$/progress")
.filter(|msg| msg["params"]["value"]["kind"] == "report")
.filter(|msg| {
msg["params"]["message"].as_str().map(|x| x.starts_with("member_")).unwrap_or(false)
msg["params"]["value"]["message"]
.as_str()
.map(|x| x.starts_with("member_"))
.unwrap_or(false)
})
.count();
assert_eq!(count, 4);
Expand Down
4 changes: 1 addition & 3 deletions tests/support/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ impl<T: AsyncRead + AsyncWrite> RlsHandle<T> {
/// Blocks until the processing (building + indexing) is done by the RLS.
#[allow(clippy::bool_comparison)]
pub fn wait_for_indexing(&mut self) {
self.wait_for_message(|msg| {
msg["params"]["title"] == "Indexing" && msg["params"]["done"] == true
});
self.wait_for_message(|msg| msg["params"]["value"]["kind"] == "end");
}

/// Blocks until a "textDocument/publishDiagnostics" message is received.
Expand Down
5 changes: 1 addition & 4 deletions tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ impl RlsHandle {
|stdout| {
stdout
.to_json_messages()
.filter(|json| {
json["params"]["title"] == "Indexing"
&& json["params"]["done"].as_bool().unwrap_or(false)
})
.filter(|json| json["params"]["value"]["kind"] == "end")
.count()
>= n
},
Expand Down

0 comments on commit 7ab4c08

Please sign in to comment.