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

Translate remaining tests #1320

Merged
merged 1 commit into from
Feb 24, 2019
Merged
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
999 changes: 931 additions & 68 deletions tests/client.rs

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions tests/support/client.rs
Original file line number Diff line number Diff line change
@@ -155,8 +155,9 @@ impl RlsHandle {
"params": params,
}));

let msg = self.wait_for_message(move |val| val["id"] == id && val.get("result").is_some());
let msg = self.wait_for_message(move |val| val["id"] == id);

// TODO: Bubble up errors
R::Result::deserialize(&msg["result"])
.unwrap_or_else(|_| panic!("Can't deserialize results: {:?}", msg))
}
@@ -187,7 +188,7 @@ impl RlsHandle {

/// Enqueues a channel that is notified and consumed when a given predicate
/// `f` is true for a received message.
fn future_msg(
pub fn future_msg(
&mut self,
f: impl Fn(&Value) -> bool + 'static,
) -> impl Future<Item = Value, Error = oneshot::Canceled> {
@@ -219,6 +220,7 @@ impl RlsHandle {
}

/// 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
3 changes: 2 additions & 1 deletion tests/support/paths.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

use std::cell::Cell;
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
@@ -38,7 +39,7 @@ fn global_root() -> PathBuf {
// `target`. If, however, `cargo test --target $target` is used then the
// output is `target/$target/debug/foo`, so our path is pointing at
// `target/$target`. Here we conditionally pop the `$target` name.
if path.file_name().and_then(|s| s.to_str()) != Some("target") {
if path.file_name().and_then(OsStr::to_str) != Some("target") {
path.pop();
}

1,604 changes: 0 additions & 1,604 deletions tests/tests_old.rs

This file was deleted.