assert_eq!(dever_runtime::task::run(true, 4, async |scope| Ok::<_, ()>(@main@(scope, "雪".to_owned()).await)).unwrap().unwrap(), Some("雪".to_owned())); let output = dever_runtime::task::run(true, 1, async |_| Ok::<_, ()>(@optional@().await)).unwrap().unwrap(); assert_eq!((output.f0, output.f1, output.f2), (None, Some(9), None)); assert_eq!(dever_runtime::task::run(true, 1, async |scope| Ok::<_, ()>(@cancel@(scope).await)).unwrap().unwrap(), Some(1)); let failure = dever_runtime::task::run(true, 1, async |_| { @sendClosed@().await; Ok::<_, ()>(()) }).unwrap().unwrap_err(); let dever_runtime::task::RunError::Fault { primary, additional } = failure else { panic!("expected channel fault") }; let info = primary.downcast_ref::<&'static FaultInfo>().unwrap(); assert_eq!(info.message, "channel is closed"); assert_eq!(info.source, @source_path@); assert!(additional.is_empty()); for capacity in [0, -1, 65537] { let failure = dever_runtime::task::run(true, 1, async |_| { @invalidCapacity@(capacity); Ok::<_, ()>(()) }).unwrap().unwrap_err(); let dever_runtime::task::RunError::Fault { primary, .. } = failure else { panic!("expected capacity fault") }; assert_eq!(primary.downcast_ref::<&'static FaultInfo>().unwrap().message, "channel capacity must be within 1..65536"); }