From 914fc9b7b49381b58e9898c29080223d8a3ece9a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 19 May 2020 20:27:14 +0200 Subject: [PATCH] Update test data --- crates/rust-analyzer/src/lsp_ext.rs | 2 + .../rust-analyzer/tests/heavy_tests/main.rs | 52 +++++-------------- crates/test_utils/src/lib.rs | 17 +++--- 3 files changed, 25 insertions(+), 46 deletions(-) diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index c7a3a6911496..f75a26eb7967 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs @@ -206,7 +206,9 @@ pub struct CodeAction { #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SnippetWorkspaceEdit { + #[serde(skip_serializing_if = "Option::is_none")] pub changes: Option>>, + #[serde(skip_serializing_if = "Option::is_none")] pub document_changes: Option>, } diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs index 5011cc2734dc..74676b3eede8 100644 --- a/crates/rust-analyzer/tests/heavy_tests/main.rs +++ b/crates/rust-analyzer/tests/heavy_tests/main.rs @@ -333,29 +333,17 @@ fn main() {} partial_result_params: PartialResultParams::default(), work_done_progress_params: WorkDoneProgressParams::default(), }, - json!([ - { - "command": { - "arguments": [ + json!([{ + "edit": { + "documentChanges": [ { - "cursorPosition": null, - "label": "Create module", - "workspaceEdit": { - "documentChanges": [ - { - "kind": "create", - "uri": "file:///[..]/src/bar.rs" - } - ] - } + "kind": "create", + "uri": "file:///[..]/src/bar.rs" } - ], - "command": "rust-analyzer.applySourceChange", - "title": "Create module" + ] }, "title": "Create module" - } - ]), + }]), ); server.request::( @@ -416,29 +404,17 @@ fn main() {{}} partial_result_params: PartialResultParams::default(), work_done_progress_params: WorkDoneProgressParams::default(), }, - json!([ - { - "command": { - "arguments": [ + json!([{ + "edit": { + "documentChanges": [ { - "cursorPosition": null, - "label": "Create module", - "workspaceEdit": { - "documentChanges": [ - { - "kind": "create", - "uri": "file:///[..]/src/bar.rs" - } - ] - } + "kind": "create", + "uri": "file://[..]/src/bar.rs" } - ], - "command": "rust-analyzer.applySourceChange", - "title": "Create module" + ] }, "title": "Create module" - } - ]), + }]), ); server.request::( diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index b1e3c328f3c5..184c58fbf879 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -471,14 +471,15 @@ pub fn read_text(path: &Path) -> String { /// also creates a file at `./target/.slow_tests_cookie` which serves as a flag /// that slow tests did run. pub fn skip_slow_tests() -> bool { - let should_skip = std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err(); - if should_skip { - eprintln!("ignoring slow test") - } else { - let path = project_dir().join("./target/.slow_tests_cookie"); - fs::write(&path, ".").unwrap(); - } - should_skip + // let should_skip = std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err(); + // if should_skip { + // eprintln!("ignoring slow test") + // } else { + // let path = project_dir().join("./target/.slow_tests_cookie"); + // fs::write(&path, ".").unwrap(); + // } + // should_skip + false } const REWRITE: bool = false;