fix make tests

This commit is contained in:
Jonathan Kelley committed 2024-02-05 12:24:59 -08:00
1 parent b63c14fab8
commit 7e54039ed2
4 files changed
+7 -4

No files matched your search

+4 -2
View File
@@ -155,8 +155,10 @@ impl Runtime {
/// This means the virtual dom is currently doing syncronous work /// This means the virtual dom is currently doing syncronous work
/// The lock will be held until `release_flush_lock` is called - and then the OwnedLock will be dropped /// The lock will be held until `release_flush_lock` is called - and then the OwnedLock will be dropped
pub(crate) fn acquire_flush_lock(&self) { pub(crate) fn acquire_flush_lock(&self) {
self.flush_lock // The flush lock might already be held...
.set(Some(self.flush_mutex.try_lock_owned().unwrap())); if let Some(lock) = self.flush_mutex.try_lock_owned() {
self.flush_lock.set(Some(lock));
}
} }
/// Release the flush lock /// Release the flush lock
+1
View File
@@ -450,6 +450,7 @@ impl VirtualDom {
// When we're doing awaiting the rx, the lock will be dropped and tasks waiting on the lock will get waked // When we're doing awaiting the rx, the lock will be dropped and tasks waiting on the lock will get waked
// We have to own the lock since poll_tasks is cancel safe - the future that this is running in might get dropped // We have to own the lock since poll_tasks is cancel safe - the future that this is running in might get dropped
// and if we held the lock in the scope, the lock would also get dropped prematurely // and if we held the lock in the scope, the lock would also get dropped prematurely
self.runtime.release_flush_lock();
self.runtime.acquire_flush_lock(); self.runtime.acquire_flush_lock();
match self.rx.next().await.expect("channel should never close") { match self.rx.next().await.expect("channel should never close") {
+1 -1
View File
@@ -16,7 +16,7 @@ async fn run_vdom(app: fn() -> Element) {
} }
#[tokio::test] #[tokio::test]
async fn it_works() { async fn running_async() {
static POLL_COUNT: AtomicUsize = AtomicUsize::new(0); static POLL_COUNT: AtomicUsize = AtomicUsize::new(0);
fn app() -> Element { fn app() -> Element {
+1 -1
View File
@@ -259,7 +259,7 @@ pub fn render<R: Driver>(
TermEvent::Resize(_, _) => updated = true, TermEvent::Resize(_, _) => updated = true,
_ => {} _ => {}
}, },
InputEvent::Close => panic!("ackkkk"), InputEvent::Close => break,
}; };
if let InputEvent::UserInput(evt) = evt.unwrap() { if let InputEvent::UserInput(evt) = evt.unwrap() {