From 84e1d50a2a408efc9972d04361c224da2eea8980 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Thu, 7 Mar 2019 18:25:35 +0200 Subject: 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. --- crates/ra_lsp_server/tests/heavy_tests/main.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'crates/ra_lsp_server/tests/heavy_tests') 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() {} #[test] fn test_missing_module_code_action_in_json_project() { let tmp_dir = TempDir::new().unwrap(); + + let path = tmp_dir.path(); + + let project = json!({ + "roots": [path], + "crates": [ { "root_module": path.join("src/lib.rs"), "deps": [], "edition": "2015" } ] + }); + let code = format!( r#" //- rust-project.json -{{ - "roots": [ "{PATH}" ], - "crates": [ {{ "root_module": "{PATH}/src/lib.rs", "deps": [], "edition": "2015" }} ] -}} +{PROJECT} //- src/lib.rs mod bar; -fn main() {} +fn main() {{}} "#, - PATH = tmp_dir.path().display() + PROJECT = project.to_string(), ); let server = project_with_tmpdir(tmp_dir, &code); server.wait_until_workspace_is_loaded(); -- cgit v1.2.3