Initial Dever 0.0.1

This commit is contained in:
Codex committed 2026-11-03 03:32:07 +00:00
commit 81233d098c
1479 files changed
+163782

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
use super::{Error, runtime};
use dever_runtime::task::Scope;
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
fn failed_factory(_: &Scope<'_>) -> std::future::Ready<()> {
panic!("future construction failed");
}
struct FailedDrop;
impl Future for FailedDrop {
type Output = ();
fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<()> {
Poll::Ready(())
}
}
impl Drop for FailedDrop {
fn drop(&mut self) {
panic!("completed future destruction failed");
}
}
fn failed_drop(_: &Scope<'_>) -> FailedDrop {
FailedDrop
}
#[test]
fn entry_catches_future_construction_and_completed_destruction_panics() {
let runtime = runtime();
assert_eq!(runtime.run(failed_factory), Err(Error::Panicked));
assert_eq!(runtime.run(failed_drop), Err(Error::Panicked));
assert_eq!(runtime.run(async |_| 42), Ok(42));
}