Skip to content

Commit

Permalink
fix tests to work with upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed May 17, 2021
1 parent 33f2d47 commit adabd40
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/bench/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn bench_startup_shutdown(deno_exe: &Path) -> Result<Duration, AnyError> {
}),
)?;

let (id, method, _): (u64, String, Option<Value>) = client.read_request()?;
let (id, method, _) = client.read_request::<Value>()?;
assert_eq!(method, "workspace/configuration");

client.write_response(
Expand Down
26 changes: 26 additions & 0 deletions cli/tests/integration_tests_lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ where
client
.write_notification("textDocument/didOpen", params)
.unwrap();

let (id, method, _) = client.read_request::<Value>().unwrap();
assert_eq!(method, "workspace/configuration");
client
.write_response(id, json!({ "enable": true }))
.unwrap();

let (method, _) = client.read_notification::<Value>().unwrap();
assert_eq!(method, "textDocument/publishDiagnostics");
let (method, _) = client.read_notification::<Value>().unwrap();
Expand Down Expand Up @@ -209,6 +216,13 @@ fn lsp_hover_disabled() {
}),
)
.unwrap();

let (id, method, _) = client.read_request::<Value>().unwrap();
assert_eq!(method, "workspace/configuration");
client
.write_response(id, json!({ "enable": false }))
.unwrap();

let (maybe_res, maybe_err) = client
.write_request(
"textDocument/hover",
Expand Down Expand Up @@ -453,6 +467,12 @@ fn lsp_hover_closed_document() {
}),
)
.unwrap();
let (id, method, _) = client.read_request::<Value>().unwrap();
assert_eq!(method, "workspace/configuration");
client
.write_response(id, json!({ "enable": true }))
.unwrap();

client
.write_notification(
"textDocument/didOpen",
Expand All @@ -466,6 +486,12 @@ fn lsp_hover_closed_document() {
}),
)
.unwrap();
let (id, method, _) = client.read_request::<Value>().unwrap();
assert_eq!(method, "workspace/configuration");
client
.write_response(id, json!({ "enable": true }))
.unwrap();

let (method, _) = client.read_notification::<Value>().unwrap();
assert_eq!(method, "textDocument/publishDiagnostics");
let (method, _) = client.read_notification::<Value>().unwrap();
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/lsp/initialize_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"willSaveWaitUntil": true,
"didSave": true
}
},
"workspace": {
"configuration": true,
"workspaceFolders": true
}
}
}
4 changes: 4 additions & 0 deletions cli/tests/lsp/initialize_params_disabled.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"willSaveWaitUntil": true,
"didSave": true
}
},
"workspace": {
"configuration": true,
"workspaceFolders": true
}
}
}
4 changes: 4 additions & 0 deletions cli/tests/lsp/initialize_params_registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
"willSaveWaitUntil": true,
"didSave": true
}
},
"workspace": {
"configuration": true,
"workspaceFolders": true
}
}
}
4 changes: 4 additions & 0 deletions cli/tests/lsp/initialize_params_unstable.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"willSaveWaitUntil": true,
"didSave": true
}
},
"workspace": {
"configuration": true,
"workspaceFolders": true
}
}
}

0 comments on commit adabd40

Please sign in to comment.