Use run_until_parked instead of blocked in tests

This commit is contained in:
Conrad Irwin 2023-11-01 14:17:10 -06:00
parent 3f34a8e7ec
commit cd10ba9e06
4 changed files with 17 additions and 16 deletions

View file

@ -2942,7 +2942,6 @@ async fn test_buffer_deduping(cx: &mut gpui2::TestAppContext) {
#[gpui2::test]
async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
init_test(cx);
dbg!("GAH");
let fs = FakeFs::new(cx.executor().clone());
fs.insert_tree(
@ -2954,7 +2953,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
}),
)
.await;
dbg!("NOOP");
let project = Project::test(fs.clone(), ["/dir".as_ref()], cx).await;
@ -2964,8 +2962,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
.unwrap();
let events = Arc::new(Mutex::new(Vec::new()));
dbg!("BOOP");
// initially, the buffer isn't dirty.
buffer1.update(cx, |buffer, cx| {
cx.subscribe(&buffer1, {
@ -2982,7 +2978,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
buffer.edit([(1..2, "")], None, cx);
});
dbg!("ADSASD");
// after the first edit, the buffer is dirty, and emits a dirtied event.
buffer1.update(cx, |buffer, cx| {
@ -3000,7 +2995,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
cx,
);
});
dbg!("1111");
// after saving, the buffer is not dirty, and emits a saved event.
buffer1.update(cx, |buffer, cx| {
@ -3012,8 +3006,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
buffer.edit([(2..2, "D")], None, cx);
});
dbg!("5555555");
// after editing again, the buffer is dirty, and emits another dirty event.
buffer1.update(cx, |buffer, cx| {
assert!(buffer.text() == "aBDc");
@ -3035,7 +3027,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
assert!(!buffer.is_dirty());
});
dbg!("666666");
assert_eq!(
*events.lock(),
&[language2::Event::Edited, language2::Event::DirtyChanged]
@ -3055,8 +3046,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
.detach();
});
dbg!("0000000");
fs.remove_file("/dir/file2".as_ref(), Default::default())
.await
.unwrap();
@ -3084,7 +3073,6 @@ async fn test_buffer_is_dirty(cx: &mut gpui2::TestAppContext) {
.detach();
});
dbg!(";;;;;;");
buffer3.update(cx, |buffer, cx| {
buffer.edit([(0..0, "x")], None, cx);
});