Fix warnings in tests

This commit is contained in:
Piotr Osiewicz 2023-11-20 19:25:14 +01:00
parent d60855b06d
commit fe0a8b4be2

View file

@ -909,7 +909,7 @@ mod tests {
.unindent(), .unindent(),
) )
}); });
let (window, cx) = cx.add_window_view(|_| EmptyView {}); let (_, cx) = cx.add_window_view(|_| EmptyView {});
let editor = cx.build_view(|cx| Editor::for_buffer(buffer.clone(), None, cx)); let editor = cx.build_view(|cx| Editor::for_buffer(buffer.clone(), None, cx));
let search_bar = cx.build_view(|cx| { let search_bar = cx.build_view(|cx| {
@ -1324,7 +1324,8 @@ mod tests {
initial_selections initial_selections
}).unwrap(); }).unwrap();
window.update(cx, |_, cx| { window
.update(cx, |_, cx| {
assert!( assert!(
editor.read(cx).is_focused(cx), editor.read(cx).is_focused(cx),
"Should still have editor focused after SelectNextMatch" "Should still have editor focused after SelectNextMatch"
@ -1350,8 +1351,10 @@ mod tests {
cx.focus(&handle); cx.focus(&handle);
search_bar.select_all_matches(&SelectAllMatches, cx); search_bar.select_all_matches(&SelectAllMatches, cx);
}); });
}); })
window.update(cx, |_, cx| { .unwrap();
window
.update(cx, |_, cx| {
assert!( assert!(
editor.read(cx).is_focused(cx), editor.read(cx).is_focused(cx),
"Should focus editor after successful SelectAllMatches" "Should focus editor after successful SelectAllMatches"
@ -1373,7 +1376,8 @@ mod tests {
search_bar.update(cx, |search_bar, cx| { search_bar.update(cx, |search_bar, cx| {
search_bar.select_prev_match(&SelectPrevMatch, cx); search_bar.select_prev_match(&SelectPrevMatch, cx);
}); });
}); })
.unwrap();
let last_match_selections = window let last_match_selections = window
.update(cx, |_, cx| { .update(cx, |_, cx| {
assert!( assert!(
@ -1414,7 +1418,8 @@ mod tests {
.unwrap() .unwrap()
.await .await
.unwrap(); .unwrap();
window.update(cx, |_, cx| { window
.update(cx, |_, cx| {
search_bar.update(cx, |search_bar, cx| { search_bar.update(cx, |search_bar, cx| {
search_bar.select_all_matches(&SelectAllMatches, cx); search_bar.select_all_matches(&SelectAllMatches, cx);
}); });
@ -1434,7 +1439,8 @@ mod tests {
"For no matches, there should be no active match index" "For no matches, there should be no active match index"
); );
}); });
}); })
.unwrap();
} }
#[gpui::test] #[gpui::test]
@ -1449,7 +1455,7 @@ mod tests {
"# "#
.unindent(); .unindent();
let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), buffer_text)); let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), buffer_text));
let (window, cx) = cx.add_window_view(|_| EmptyView {}); let (_, cx) = cx.add_window_view(|_| EmptyView {});
let editor = cx.build_view(|cx| Editor::for_buffer(buffer.clone(), None, cx)); let editor = cx.build_view(|cx| Editor::for_buffer(buffer.clone(), None, cx));