Fix diagnostics randomized tests (#21775)
These were silently passing after the delay in updating diagnostics was added. Co-Authored-By: Max <max@zed.dev> cc @someonetoignore Release Notes: - N/A --------- Co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
8a85d6ef96
commit
a35ef5b79f
5 changed files with 66 additions and 61 deletions
|
@ -809,7 +809,7 @@ async fn test_random_diagnostics(cx: &mut TestAppContext, mut rng: StdRng) {
|
|||
|
||||
updated_language_servers.insert(server_id);
|
||||
|
||||
project.update(cx, |project, cx| {
|
||||
lsp_store.update(cx, |lsp_store, cx| {
|
||||
log::info!("updating diagnostics. language server {server_id} path {path:?}");
|
||||
randomly_update_diagnostics_for_path(
|
||||
&fs,
|
||||
|
@ -818,10 +818,12 @@ async fn test_random_diagnostics(cx: &mut TestAppContext, mut rng: StdRng) {
|
|||
&mut next_group_id,
|
||||
&mut rng,
|
||||
);
|
||||
project
|
||||
lsp_store
|
||||
.update_diagnostic_entries(server_id, path, None, diagnostics.clone(), cx)
|
||||
.unwrap()
|
||||
});
|
||||
cx.executor()
|
||||
.advance_clock(DIAGNOSTICS_UPDATE_DEBOUNCE + Duration::from_millis(10));
|
||||
|
||||
cx.run_until_parked();
|
||||
}
|
||||
|
@ -842,10 +844,25 @@ async fn test_random_diagnostics(cx: &mut TestAppContext, mut rng: StdRng) {
|
|||
cx,
|
||||
)
|
||||
});
|
||||
cx.executor()
|
||||
.advance_clock(DIAGNOSTICS_UPDATE_DEBOUNCE + Duration::from_millis(10));
|
||||
cx.run_until_parked();
|
||||
|
||||
let mutated_excerpts = get_diagnostics_excerpts(&mutated_view, cx);
|
||||
let reference_excerpts = get_diagnostics_excerpts(&reference_view, cx);
|
||||
|
||||
for ((path, language_server_id), diagnostics) in current_diagnostics {
|
||||
for diagnostic in diagnostics {
|
||||
let found_excerpt = reference_excerpts.iter().any(|info| {
|
||||
let row_range = info.range.context.start.row..info.range.context.end.row;
|
||||
info.path == path.strip_prefix("/test").unwrap()
|
||||
&& info.language_server == language_server_id
|
||||
&& row_range.contains(&diagnostic.range.start.0.row)
|
||||
});
|
||||
assert!(found_excerpt, "diagnostic not found in reference view");
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(mutated_excerpts, reference_excerpts);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue