aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/tests/heavy_tests/main.rs
diff options
context:
space:
mode:
authorRoberto Vidal <[email protected]>2019-04-13 19:33:49 +0100
committerRoberto Vidal <[email protected]>2019-04-14 09:04:38 +0100
commitc2dfc8a229c0a18dff08d5ce7e6836c91648eee5 (patch)
treeb43609791839b9ba98f281fda2efbb8ced1168b1 /crates/ra_lsp_server/tests/heavy_tests/main.rs
parent7c7cfc5f04c51ed1e31b6a3091efc3941b3383c2 (diff)
Modifies runnables test to use multi-workspace root
Diffstat (limited to 'crates/ra_lsp_server/tests/heavy_tests/main.rs')
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs35
1 files changed, 23 insertions, 12 deletions
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index e9ce002de..6f37a980d 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -14,7 +14,7 @@ use ra_lsp_server::req::{
14use serde_json::json; 14use serde_json::json;
15use tempfile::TempDir; 15use tempfile::TempDir;
16 16
17use crate::support::{project, project_with_tmpdir}; 17use crate::support::{project, Project};
18 18
19const LOG: &'static str = ""; 19const LOG: &'static str = "";
20 20
@@ -95,25 +95,34 @@ fn foo() {
95 95
96#[test] 96#[test]
97fn test_runnables_project() { 97fn test_runnables_project() {
98 let server = project( 98 let code = r#"
99 r#" 99//- foo/Cargo.toml
100//- Cargo.toml
101[package] 100[package]
102name = "foo" 101name = "foo"
103version = "0.0.0" 102version = "0.0.0"
104 103
105//- src/lib.rs 104//- foo/src/lib.rs
106pub fn foo() {} 105pub fn foo() {}
107 106
108//- tests/spam.rs 107//- foo/tests/spam.rs
109#[test] 108#[test]
110fn test_eggs() {} 109fn test_eggs() {}
111"#, 110
112 ); 111//- bar/Cargo.toml
112[package]
113name = "bar"
114version = "0.0.0"
115
116//- bar/src/main.rs
117fn main() {}
118"#;
119
120 let server = Project::with_fixture(code).root("foo").root("bar").server();
121
113 server.wait_until_workspace_is_loaded(); 122 server.wait_until_workspace_is_loaded();
114 server.request::<Runnables>( 123 server.request::<Runnables>(
115 RunnablesParams { 124 RunnablesParams {
116 text_document: server.doc_id("tests/spam.rs"), 125 text_document: server.doc_id("foo/tests/spam.rs"),
117 position: None, 126 position: None,
118 }, 127 },
119 json!([ 128 json!([
@@ -126,7 +135,7 @@ fn test_eggs() {}
126 "end": { "character": 17, "line": 1 }, 135 "end": { "character": 17, "line": 1 },
127 "start": { "character": 0, "line": 0 } 136 "start": { "character": 0, "line": 0 }
128 }, 137 },
129 "cwd": server.path() 138 "cwd": server.path().join("foo")
130 }, 139 },
131 { 140 {
132 "args": [ 141 "args": [
@@ -138,7 +147,7 @@ fn test_eggs() {}
138 ], 147 ],
139 "bin": "cargo", 148 "bin": "cargo",
140 "env": {}, 149 "env": {},
141 "cwd": server.path(), 150 "cwd": server.path().join("foo"),
142 "label": "cargo check -p foo", 151 "label": "cargo check -p foo",
143 "range": { 152 "range": {
144 "end": { 153 "end": {
@@ -287,7 +296,9 @@ fn main() {{}}
287"#, 296"#,
288 PROJECT = project.to_string(), 297 PROJECT = project.to_string(),
289 ); 298 );
290 let server = project_with_tmpdir(tmp_dir, &code); 299
300 let server = Project::with_fixture(&code).tmp_dir(tmp_dir).server();
301
291 server.wait_until_workspace_is_loaded(); 302 server.wait_until_workspace_is_loaded();
292 let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None }; 303 let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None };
293 server.request::<CodeActionRequest>( 304 server.request::<CodeActionRequest>(