use std::time::Duration;
#[runite::test]
async fn drives_async_body() {
let before = std::time::Instant::now();
runite::time::sleep(Duration::from_millis(5)).await;
assert!(before.elapsed() >= Duration::from_millis(5));
}
#[runite::test]
async fn supports_result_return() -> Result<(), Box<dyn std::error::Error>> {
runite::time::sleep(Duration::from_millis(1)).await;
let value: u32 = "42".parse()?;
assert_eq!(value, 42);
Ok(())
}
#[runite::test]
async fn can_spawn_tasks() {
let handle = runite::spawn(async { 7u32 + 8 });
assert_eq!(handle.await.expect("spawned task should finish"), 15);
}
#[runite::test]
#[should_panic = "expected boom"]
async fn forwards_should_panic() {
panic!("expected boom");
}
#[runite::test(crate = "runite")]
async fn honors_crate_path_argument() {
let handle = runite::spawn(async { 21u32 * 2 });
assert_eq!(handle.await.expect("spawned task should finish"), 42);
}