aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-03-07 16:25:35 +0000
committerVille Penttinen <[email protected]>2019-03-07 17:27:06 +0000
commit84e1d50a2a408efc9972d04361c224da2eea8980 (patch)
treecb9f6c26aae571224bb27e2aed09adcd49314235 /crates/ra_lsp_server
parenta41d8e140ca65cb87bf6e69a35c3e86410aba374 (diff)
Fix test_missing_module_code_action_in_json_project on Windows
The test would fail on Windows due to the paths not being properly escaped for JSON. In addition adds extra braces around the fn main to actually introduce braces in the file.
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index 6ae541ec6..407719080 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -263,20 +263,25 @@ fn main() {}
263#[test] 263#[test]
264fn test_missing_module_code_action_in_json_project() { 264fn test_missing_module_code_action_in_json_project() {
265 let tmp_dir = TempDir::new().unwrap(); 265 let tmp_dir = TempDir::new().unwrap();
266
267 let path = tmp_dir.path();
268
269 let project = json!({
270 "roots": [path],
271 "crates": [ { "root_module": path.join("src/lib.rs"), "deps": [], "edition": "2015" } ]
272 });
273
266 let code = format!( 274 let code = format!(
267 r#" 275 r#"
268//- rust-project.json 276//- rust-project.json
269{{ 277{PROJECT}
270 "roots": [ "{PATH}" ],
271 "crates": [ {{ "root_module": "{PATH}/src/lib.rs", "deps": [], "edition": "2015" }} ]
272}}
273 278
274//- src/lib.rs 279//- src/lib.rs
275mod bar; 280mod bar;
276 281
277fn main() {} 282fn main() {{}}
278"#, 283"#,
279 PATH = tmp_dir.path().display() 284 PROJECT = project.to_string(),
280 ); 285 );
281 let server = project_with_tmpdir(tmp_dir, &code); 286 let server = project_with_tmpdir(tmp_dir, &code);
282 server.wait_until_workspace_is_loaded(); 287 server.wait_until_workspace_is_loaded();