attempt to fix broken test

This commit is contained in:
K Simmons 2022-07-22 10:55:57 -07:00
parent a076eeeb96
commit b93040a6ae

View file

@ -608,34 +608,34 @@ mod tests {
// Hover pops diagnostic immediately // Hover pops diagnostic immediately
cx.update_editor(|editor, cx| hover(editor, &Hover, cx)); cx.update_editor(|editor, cx| hover(editor, &Hover, cx));
cx.condition(|Editor { hover_state, .. }, _| { cx.foreground().run_until_parked();
hover_state.diagnostic_popover.is_some() && hover_state.info_popover.is_none()
}) cx.editor(|Editor { hover_state, .. }, _| {
.await; assert!(hover_state.diagnostic_popover.is_some() && hover_state.info_popover.is_none())
});
// Info Popover shows after request responded to // Info Popover shows after request responded to
let range = cx.lsp_range(indoc! {" let range = cx.lsp_range(indoc! {"
fn [test]() fn [test]()
println!();"}); println!();"});
let mut requests = cx.handle_request::<lsp::request::HoverRequest, _, _>(move |_, _, _| async move {
cx.handle_request::<lsp::request::HoverRequest, _, _>(move |_, _, _| async move { Ok(Some(lsp::Hover {
Ok(Some(lsp::Hover { contents: lsp::HoverContents::Markup(lsp::MarkupContent {
contents: lsp::HoverContents::Markup(lsp::MarkupContent { kind: lsp::MarkupKind::Markdown,
kind: lsp::MarkupKind::Markdown, value: indoc! {"
value: indoc! {" # Some other basic docs
# Some other basic docs Some other test documentation"}
Some other test documentation"} .to_string(),
.to_string(), }),
}), range: Some(range),
range: Some(range), }))
})) });
});
cx.foreground() cx.foreground()
.advance_clock(Duration::from_millis(HOVER_DELAY_MILLIS + 100)); .advance_clock(Duration::from_millis(HOVER_DELAY_MILLIS + 100));
requests.next().await;
cx.condition(|Editor { hover_state, .. }, _| { cx.foreground().run_until_parked();
cx.editor(|Editor { hover_state, .. }, _| {
hover_state.diagnostic_popover.is_some() && hover_state.info_task.is_some() hover_state.diagnostic_popover.is_some() && hover_state.info_task.is_some()
}) });
.await;
} }
} }