summaryrefslogtreecommitdiff
path: root/cli/bench/lsp_bench_standalone.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-09 15:09:03 -0500
committerGitHub <noreply@github.com>2023-03-09 15:09:03 -0500
commit47012bd931e785073e943b82dd397386b6ee7ca5 (patch)
tree82e2695413c72bd124f55a8bc5423c2b79d63f34 /cli/bench/lsp_bench_standalone.rs
parent2f81e555d88e45a7ec9b5a5bc511fd3ea4d9c75f (diff)
refactor(tests/lsp): consolidate more into test LspClient and reduce verbosity (#18100)
Diffstat (limited to 'cli/bench/lsp_bench_standalone.rs')
-rw-r--r--cli/bench/lsp_bench_standalone.rs47
1 files changed, 21 insertions, 26 deletions
diff --git a/cli/bench/lsp_bench_standalone.rs b/cli/bench/lsp_bench_standalone.rs
index 888d959ac..60d5be2d1 100644
--- a/cli/bench/lsp_bench_standalone.rs
+++ b/cli/bench/lsp_bench_standalone.rs
@@ -14,34 +14,29 @@ fn incremental_change_wait(bench: &mut Bencher) {
let mut client = LspClientBuilder::new().build();
client.initialize_default();
- client
- .write_notification(
- "textDocument/didOpen",
- json!({
- "textDocument": {
- "uri": "file:///testdata/express-router.js",
- "languageId": "javascript",
- "version": 0,
- "text": include_str!("testdata/express-router.js")
- }
- }),
- )
- .unwrap();
+ client.write_notification(
+ "textDocument/didOpen",
+ json!({
+ "textDocument": {
+ "uri": "file:///testdata/express-router.js",
+ "languageId": "javascript",
+ "version": 0,
+ "text": include_str!("testdata/express-router.js")
+ }
+ }),
+ );
- let (id, method, _): (u64, String, Option<Value>) =
- client.read_request().unwrap();
+ let (id, method, _): (u64, String, Option<Value>) = client.read_request();
assert_eq!(method, "workspace/configuration");
- client
- .write_response(
- id,
- json!({
- "enable": true
- }),
- )
- .unwrap();
+ client.write_response(
+ id,
+ json!({
+ "enable": true
+ }),
+ );
let (method, _maybe_diag): (String, Option<Value>) =
- client.read_notification().unwrap();
+ client.read_notification();
assert_eq!(method, "textDocument/publishDiagnostics");
let mut document_version: u64 = 0;
@@ -61,7 +56,7 @@ fn incremental_change_wait(bench: &mut Bencher) {
{"text": text, "range":{"start":{"line":509,"character":10},"end":{"line":509,"character":16}}}
]
})
- ).unwrap();
+ );
wait_for_deno_lint_diagnostic(document_version, &mut client);
@@ -75,7 +70,7 @@ fn wait_for_deno_lint_diagnostic(
) {
loop {
let (method, maybe_diag): (String, Option<Value>) =
- client.read_notification().unwrap();
+ client.read_notification();
if method == "textDocument/publishDiagnostics" {
let d = maybe_diag.unwrap();
let msg = d.as_object().unwrap();