Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@ impl RlsHandle {
)
}

/// Blocks until a json message has `json["id"] == id`.
///
/// Returns the json message.
pub fn wait_until_json_id(&self, id: u64, timeout: Duration) -> serde_json::Value {
self.wait_until(
|stdout| stdout.to_json_messages().any(|json| json["id"] == id),
timeout,
)
.to_json_messages()
.rfind(|json| json["id"] == id)
.unwrap()
}

pub fn stdout(&self) -> RlsStdout {
let stdout = self.stdout.lock().unwrap();
RlsStdout {
Expand Down
Loading