Add randomized test for DisplayMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
parent
576cabea93
commit
c1808d09ef
@@ -875,11 +875,10 @@ mod tests {
|
||||
display_map::{fold_map::FoldMap, tab_map::TabMap},
|
||||
Buffer,
|
||||
},
|
||||
test::Observer,
|
||||
util::RandomCharIter,
|
||||
};
|
||||
use gpui::ModelHandle;
|
||||
use rand::prelude::*;
|
||||
use smol::channel;
|
||||
use std::env;
|
||||
|
||||
#[gpui::test(iterations = 100)]
|
||||
@@ -1077,26 +1076,4 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Observer;
|
||||
|
||||
impl Entity for Observer {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
impl Observer {
|
||||
fn new(
|
||||
handle: &ModelHandle<WrapMap>,
|
||||
cx: &mut gpui::TestAppContext,
|
||||
) -> (ModelHandle<Self>, channel::Receiver<()>) {
|
||||
let (notify_tx, notify_rx) = channel::unbounded();
|
||||
let observer = cx.add_model(|cx| {
|
||||
cx.observe(handle, move |_, _, _| {
|
||||
let _ = notify_tx.try_send(());
|
||||
});
|
||||
Observer
|
||||
});
|
||||
(observer, notify_rx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user